Yep. It’s all just physics and chemistry.
There is a gradient of temperature from the surface to the inside of the food. Depending on the composition, it will take more or less time for the thermal energy to propagate.
In addition, cooking involves chemical reactions. Now, I’m not a biochemist, but if I had to guess, most cooking chemical reactions are probably endothermic (short of setting your food on fire), in which case the chemical reaction comes f cooking will remove thermal energy from your cooking medium (e.g. water or oil) and your cooking medium will cool down even if you had perfect insulation.