Coconuts can be a rather confusing fruit. At first look, they could easily be thought a nut. They have an extremely hard and thick outer shell, trees seem to just sprout from that one “nut”, and “coconut” literally has the word “nut” in the name.
However, coconuts are not nuts in any sense of the word. They’re actually drupes. They grow with a thick, dry, fibrous husk surrounding them, and although this usually is cut off before being sold, this “husk” is botanically most of the fruit, analogous to all of the parts of say, a peach, which we would eat. The portion of the coconut which we buy is the pit of the coconut fruit. All the portions we eat and drink are part of the coconut seed.
The botany behind coconuts is pretty irrelevant though. The flesh of the coconut does not taste “nutty”, and coconuts are filled with coconut water. Coconut meat is also softer than a nut would be. They are not culinary nuts.
Coconuts are used in almost all types of cuisine and are a very versatile fruit. They are fairly often cooked, but also often eaten raw. They are fairly sweet and most commonly eaten in desserts or as a sweet, contrasting flavor to a savory dish. Coconuts are not eaten as a vegetable; they are fruits.