It's not so much about energy intake (though that is the baseline... laws of thermodynamics yadda yadda) - energy partition is far more the important factor.
You're not a simple internal combustion engine, you are a complex biochemical, metabolically active person. You have two basic energy pathways in the body... you can either burn energy or you can store it. And whether you burn energy or store it is down to complex biochemical signalling pathways, things like insulin, ghrelin and other appetite hormones.
Imagine you live totally off grid and have solar panels on your roof. Energy intake sufficient to run your appliances is contingent on the sun falling on your roof... it's a simple linear model, where input = output, like the calories in vs calories out model of dieting expounds.
Now add in a Tesla battery bank. Now, if you take in excess energy on a sunny day, you can store it. Electrical detectors and signalling in your system determine whether energy is used up immediately on the fly for appliances running right now, or stored for later when it is dark/cloudy. The human body has its own battery system like this... it's called the liver. You can either burn energy right now or store it for later by building up a fatty liver.
This is a relatively healthy adaptation for humans living in primeval times who experienced days and weeks of fasting due to poor luck on hunting expeditions, lean seasons, storms destroying the gathering crop etc etc. They had stores to fall back on. But today where we have year round abundance of processed food in the supermarkets, the batteries keep getting topped up perpetually, to breaking point, where people suffer obesity, T2 diabetes, non alcoholic fatty liver disease and many others associated with metabolic syndrome.
Sort out the energy signalling problem by controlling insulin production through diet and controlled fasting and most of these problems fall away. So eat minimal sugars and processed carbs. Eat at least half a plateful of mainly above-ground vegetables or salad. Standard size piece of meat/fish eg lamb chop. Lots of good fats like grass fed butter, olive oil and coconut. The old Mediterranean diet basically (ie not the pasta/pizza/churros version). Some eggs, dairy if you tolerate it, nuts and berries and you're good to go. Herbs and seasonings for flavour.
Check out Dr Jason Fung, Canadian nephrologist on youtube, who endorses LCHF & fasting for his patients and readers.