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.