Fruit is a term with specific, botanical (i.e. scientific) meaning. Fruit has meaning in relation to what part of a plant it is, and its function in the plant lifecycle.
Vegetable is a colloquial term without a specific scientific meaning. It has meaning in terms of how humans describe the food they eat. “Fruits” that have savory food applications are commonly called vegetables. They are both a fruit (botanically) and a vegetable (by how they are used in food).