There are many ways to classify food. The good old macronutrient approach is primarily linked with energy production: just anybody will tell you that you need to eat carbs to have energy (never mind that it conflicts with the widespread knowledge that fat is very calorie-dense, with almost twice the calories of protein or carbs for the same weight).
This energy-oriented approach makes sense if you consider that for a long time the main concern of humankind was survival and getting enough calories was a matter or life and death.
The micronutrient approach started with the discovery of vitamins. While this scientific breakthrough opened new horizons in nutrition, it also created the enduring myth that sugar equals vitamins, because fruits were the first foods to be associated with vitamins.
Since then we have discovered that, in fact, many vegetables are richer in vitamins than fruit.