Food can be very confusing.
Botanically, fruits and vegetables are classified depending on which part of the plant they come from. A fruit develops from the flower of a plant, while the other parts of the plant are categorized as vegetables. Fruits contain seeds, while vegetables can consist of roots, stems and leaves.
(Source, where you can read loads more interesting things)