There are two definitions for a fruit. One is in a botanists’ perspective and the other is a cook’s perspective. A fruit is something that is the natural ‘product’ of the plant, and not any ‘part’ of the plant itself. Of course, some fleshy parts of the plant are also considered as fruits, like rhubarb.
Scientifically speaking, a tomato is a fruit. In a grocery shop, bananas, apples, grapes, strawberries and so on are considered as fruits, while tomatoes, green beans, squash and potatoes are considered as vegetables. However, fruit, in a strict botanical sense, is a dry or fleshy ripened ovary of a plant enclosing the seed or seeds. So, in that sense, a tomato will fall under the fruit category. Vegetables are those that come from all other parts of the plant, like:
Root Crops: Carrots, turnips.
Bulbs: Onion and garlic.
Stems: Asparagus, potatoes.
Leaves: Lettuce and cabbage.
Flowers: Broccoli and cauliflower.
In a technical sense, anything that does not contain seeds is a vegetable, and almost everything that contains seeds is a fruit. Technically, a fruit is a seed bearing part of a flower and is not necessarily edible, while a vegetable is any edible, non-seed bearing part of the plant.
A fruit forms from the reproductive part of the plant, which is the flower. The flower consists of male reproductive organs called ‘Androecium’, where pollen resides. The female reproductive organ is called ‘Gynoecium’. It consists of the ovary, style and stigma. The pollen falls on the stigma and gets absorbed, and travels along the style until it reaches the ovary. The pollen (single celled) fertilizes the egg in the ovule, and forms seed. The surrounding part of the seed becomes fleshy. The resulting structure is called a fruit. Tomatoes also result in this fashion, and hence it is undoubtedly a fruit and not vegetable. Even cucumbers, green beans, squash and walnuts are fruits, though in a grocery shop we classify them under vegetables.