I think I learned this the hard way by under-eating but always eating noodles and bagels (carbs were king in the 1990s). Back then, my D3 team lived on daily "carbo loading" which was code for bagels and pasta.
The calories-in vs. calories-out implies that your body processes 100 calories of bagel the same way it processes 100 calories of steak or raw carrot or whatever. The caloric uptake is what matters the most and the insulin response to what you eat. I wish I had known this 30 years ago.
What is true for people with diabetes is also true for those of us who don't have diabetes - blood sugar matters a lot.