Fruits develop from pollinated flowers and related tissues, and contain seeds
Vegetables are other parts of the plant, such as leaves, stems, or roots.
Tomatoes, along with a lot of other things, such as cucumbers, peppers, green beans, avocadoes, all varieties of squash, and many other things, are actually fruits. However, in culinary uses, they are treated as a vegetable.
As a general rule, ask "Does this contain seeds?"
If yes, it's a fruit.
If no, it's a vegetable.
Some things are exceptions of course, like "seedless" varieties (EDIT: Even in the case of "seedless" fruits, the seeds are usually still there, just not developed)