Is a tomato a fruit or a vegetable?
Both, depending on whose definition you use — and the disagreement is not a trick question, it reflects two genuinely different classification systems.
Botanically, a fruit is the mature ovary of a flowering plant, containing the seeds. By that definition a tomato is unambiguously a fruit. So are cucumbers, courgettes, aubergines, peppers, pumpkins, avocados, olives, and — surprisingly to most people — green beans and peas in the pod, since the pod is the ovary.
"Vegetable" has no botanical meaning at all. It is a culinary and commercial category covering any edible plant part used in savoury cooking: roots (carrots), stems (celery), leaves (spinach), flowers (broccoli), tubers (potatoes) and, yes, fruits (tomatoes).
So the two systems are not in competition. One classifies by plant anatomy; the other by how the food is used at the table. A tomato is a botanical fruit and a culinary vegetable, and both statements are correct.
The US Supreme Court settled it legally in 1893. In Nix v. Hedden, tariffs applied to imported vegetables but not fruit, and an importer argued tomatoes were fruit. The court ruled unanimously that for tariff purposes tomatoes were vegetables, because in ordinary usage they are served with dinner rather than dessert. The judgment explicitly acknowledged the botanical position and set it aside as irrelevant to the statute.
Other cases where the systems disagree:
Rhubarb is a stem, so botanically a vegetable, used as a fruit.
Strawberries are not botanically berries — the seeds on the outside are the actual fruits, and the red flesh is swollen receptacle tissue.
Bananas, tomatoes, grapes and avocados are botanically berries.
Peanuts are legumes, not nuts. Almonds and cashews are seeds of drupes, not true nuts.
Use whichever system fits the context.