Because we eat the flowering part of the broccoli plant, it is actually considered to be a fruit.
This question has been posed many times and is still the source of much debate among those who still assert that broccoli is a vegetable. Even when the reproductive part of the plant is eaten, it is still considered to be a fruit.
Vegetables are called that because of the part of the plant which is eaten, such as with foods like spinach, potatoes, carrots, and lettuce which are all true vegetables. It all depends on the part of the plant which is being consumed and in this case it is the flowering part of the plant.