The question of whether tomato is a fruit or a vegetable is a non-question. In the broad sense of the word all plant material available to be eaten is a vegetable. However, we subdivide the vegetable fruits that we eat into different kinds, and this division has given rise to the question of whether or not tomato is vegetable or fuit.
In looser usage we group certain foods together as vegetables. These include those that grow underground, such as roots and tubers. Potatoes are tubers and carrots are swollen tap roots. We eat the leaves of other plants, such as lettuce. Some other plants can have edible flowers, such as cucumbers. All these we class loosely as vegetables as oposed to fruits. However, this loose usage finds many people classifying cucumbers and marrows as vegetables, even though they are actually the fruit of the plant. This mistake probably arises because they are green, like the bulk of what we call vegetables.
This loose colloquial usage has the word fruit reserved for the seed bearing organs of the plant, such as apples and berries. Tomato certainly belongs to the category of fruits, as it is a seed bearing organ of the plant. Yet it is eaten as a vegetable in salads. But so also apple can be included in a salad, even though it is a seed bearer.
So you see the division between vegetables and fruits is a false one depending upon the loose usage of terminology. Tomato is both fruit and vegetable.