We can divide our food into plant, animal, other living and non-living. Plants get energy from the sun; animal energy comes from plants (directly by eating them, or indirectly by eating other animals). Humans, as animals, don’t get energy from the sun. We mostly eat parts of (formerly) living things, plus water and salt.
Other food from living sources, besides plants or animals, includes yeast, fungi (mushrooms) and mold (blue cheese). We also ingest a lot of bacteria when eating other foods, including fermented foods. The bacteria inside us affects our health even if we aren’t getting calories from it.
Non-living foods include water (all our drinks, including milk and juice, are mostly water) and minerals (salt). Water and minerals have no calories (no fat, protein or carbohydrates) and don’t necessarily count as “food”.
For animals, we can eat their meat, milk, eggs and sometimes other animal products (honey). Milk works because it’s evolutionarily designed to be food. Eggs work because they contain nutrients for reproducing a new animal. Honey works because it’s a food source (for bees, but they’re sufficiently evolutionary related to us).
For plants, what we eat most are seeds. We also eat a lot of fruits and can eat many other parts of plants. Examples:
leaves (lettuce), stem (celery), roots (carrot), tubers (potato), bulbs (onion) and flowers (broccoli). [source]
We can also get sap from plants, which we use in maple syrup.
Seeds have useful nutrients to enable reproduction; they’re like plant eggs. Fruits are also involved in reproduction. They’re often edible so that that animals will move seeds around. Fruits ripen but seeds don’t. Fruits contain seeds but not vice versa. Fruits have more water than seeds. Details: https://www.difference.wiki/fruit-vs-seed/ and https://pediaa.com/difference-between-fruit-and-seed/
“Vegetable” is a vague word, whereas words like fruit, seed, stem, leaf, root and flower have clearer meanings. Many “vegetables” are fruits (all the ones with seeds in them). We tend to count fruits as vegetables when they aren’t sweet. When we eat a part of a plant that isn’t a fruit or seed, we tend to call that a vegetable too. Apparently “vegetable” originally meant any edible part of a plant, but we later started excluding seeds and sweet fruits (and including mushrooms), which made the term somewhat arbitrary.
Grains are grass seeds, nuts are tree seeds, and beans are legume seeds. Legumes are seeds that come in pods like green beans, and include beans, peas and lentils (we often dry these foods out). There are also other uncategorized seeds like sunflower or pumpkin. Pits in fruits are protection around seeds to prevent the seeds from being eaten.
Above-ground plant stalks, stems and trunks need rigidity to stand up in the air. Underground doesn’t need as much rigidity because the earth supports it. We don’t eat a lot of really rigid parts of plants, besides seeds (which we often cook and may grind into flour). We also can’t eat a lot of tree leaves or grass stalks even though they aren’t rigid, but other animals often do eat those. Cows have multiple stomachs because it takes a lot of work to digest those foods. Not many animals eat extremely rigid plant parts like wood.
Many parts of plants, other than fruit, have defenses to discourage eating them. Defenses can include thorns, bitter flavor, poison, being underground, being high in the air, or hard layers (including bark, pits or shells).
A Grassy Trend in Human Ancestors' Diets says humans may have eaten food from grasses a million years before eating meat.
This isn’t exact but gives a rough idea of what kinds of food exist and why. It gives some broad conceptual categories to fit foods into. Corrections are welcome but I’m not very interested in terminological details like nuts vs. drupes or grasses vs. rushes vs. sedges.