The sun and outer space. The earth gets hotter when the sun is shining on part of it and it’s gets colder when it is facing outer space. Light and dark.
The turning of the earth mitigates both phenomena so the temperature of the earth remains within a narrow band. All fossil fuels are caused by sunlight.