It works like this: If you're unfit, your capacity for output during exercise is less. If you're fitter, your capacity for output during exercise is higher.
An unfit person doing exercise, will therefore burn significantly fewer calories than someone who is fit if they exercise for the same duration at the same perceived effort.
If I go for a hard 1 hour bike ride, I burn 3 cheeseburgers. An unfit person will struggle to burn much more than 1 despite working as hard as they can.
What getting fitter enables you to do is increase the output without it feeling harder, either through increased duration or increased speed/power/etc.
Be wary of using heart rate as an indicator of this - it varies massively between people, and approximating energy output from it is not much better than using math.rand(). If you’re training to the same heart rate but your speed is going up, you can say you’re improving, but you can’t apply an absolute measure to it with any accuracy.
And then my wife had to go on an extended elimination diet to deal with gastrointestinal issues and I joined as moral support. In the space of a month, with absolutely no exercise happening, I dropped 10kgs. And I don’t think I’d ever felt healthier. As soon as I got back to running I was as quick as I’d ever been, no great surprise I guess given how much lighter I was.
Turns out the biggest impact I could have on my health was being more conscious of what I was eating. I couldn’t out run what I was putting in my mouth, no matter the distances I was putting in.