You're only confused because words are used differently in biology and in cooking. In biology, a fruit is anything that contains seeds. Which tomatoes definitely do. So do cucumbers and peppers, and courgettes (zucchini) when they grow big enough to become marrows, and peas ARE the seeds of the plant.
The biological consideration is about how the plant reproduces. If this thing would produce new plants if it fell on the ground and the seeds start to grow, it's a fruit. And the trick a lot of plants have evolved to get themselves spread around wider is to make the fruit tasty, so animals will eat the fruit, hard seeds won't get digested, they come out again in the animal's poop, hopefully the animal poops somewhere else on some good soil, and bingo, new plants grow in a new place.
But in cooking, tomatoes aren't sweet things that you think of and use in the same way as other fruits, so they are considered to be vegetables. In cooking, it's all about how you USE them, not what they biologically ARE.
Consider rhubarb. What you eat is the thick leaf stems (absolutely not the leaves as they're poisonous) so that's not biologically a fruit. But you can eat It cooked in rhubarb crumble, in a fruit pie, it goes in German Rabarbakuchen (rhubarb cake)... it is very definitely a dessert ingredient so for cooking purposes it certainly belongs under the heading of fruit.
It's all about how we use words in what context. So this is a question of language, which isn't necessarily logical.