We categories plants in a number of different ways, and the same goes for foods. Often the categorizations overlap, but sometimes they do not.
When talking about whether tomatoes are fruits or vegetables, you have to first consider in what context you are referring to them.
In the scientific or botanical sense, a fruit is simply any part of a plant which contains its seeds. So in this context, tomatoes are fruits.
However, in culinary (cooking) terminology, a fruit refers to those seed structures which are sweet-tasting in their raw form. Those which are not sweet are typically put in the vegetable category, and this is where we put tomatoes.
The bottom line is that tomatoes are technically fruits, however in common, everyday, or culinary speech we refer to them as vegetables.