Although fiber doesn't contain calories, it's included under the Macronutrient category because it plays such an important role in optimal health.
Most foods are made of up all three macronutrients (carbohydrates, proteins, and fats) in varying amounts. However, we categorize a food according to its highest macronutrient.
For example, 1 cup of chickpeas contains:
44 grams of carbohydrates
14 grams of protein
4 grams of fat
Although chickpeas contain a significant amount of protein, they're categorized as a carbohydrate since they contain a higher amount of carbohydrates.