The confusion about ‘fruit’ and ‘vegetable’ arises because of the differences in usage between scientists and cooks.
To really figure out if a tomato is a fruit or vegetable, you need to know what makes a fruit a fruit, and a vegetable a vegetable. The big question to ask is, DOES IT HAVE SEEDS? If the answer is yes, then technically, (botanically) you have a FRUIT. This, of course, makes your tomato a fruit. It also makes cucumbers, squash, green beans and walnuts all fruits as well. Along with the fruit from a plant or tree, we can often eat the leaves (lettuce,) stems (celery,) roots (carrots,) and flowers (broccoli). Many of these other parts of the plant are typically referred to as VEGETABLES.
Now don’t go looking for tomatoes next to the oranges in your grocery stores; fruits like tomatoes and green beans are usually (alas, incorrectly) referred to as “vegetables” in most grocery stores and cookbooks.
Refer : Oxford