This question has two viewpoints—scientific and culinary.
Fruit: Botanically, a fruit is the ripened ovary, together with seeds, of a flowering plant. In many species, the fruit incorporates the ripened ovary and surrounding tissues. Fruits are the means by which flowering plants disseminate seeds for regenerating.
Does it have seeds? If so, then technically, you have a fruit. Yes, tomatoes (and peppers, eggplants, cucumbers and squashes) are fruits. Even true nuts, like acorns and chestnuts, are fruits. And grains are considered the dried fruit of cereal grasses.
In cuisine, fruit refers to those plants that are sweet and fleshy—not items cooked or used in savory dishes.
Vegetables: The word ‘vegetable’ is not a botanical term and thus there is no contradiction in referring to a plant part as a fruit while also considering it a vegetable.
For a botanist, ‘vegetable’ is an umbrella word for all the edible parts of a plant—leaves (lettuce, spinach, kale), stems (asparagus, celery), roots (carrots, beets), tubers (potatoes), flowers (broccoli), bulbs (onions, garlic) and seeds (peas, beans).
For the average person, whether it’s a fruit or vegetable doesn’t really matter. What does matter is that we eat 5 to 8 servings everyday. So eat those fruity tomatoes, cucumbers and peppers and just plain enjoy.