An explanation of how the energy stored in coal, oil and gas originally came from the sun.
All of the energy contained within coal, oil and gas originally came from the sun. Ten million years ago, plants used sunlight for Photosynthesis, converting solar energy into chemical. Later, the plants (and animals which may have eaten the plants, or at least eaten other animals who had eaten the plants, etc.) died and their corpses were submerged under layers of sediment, and as they fossilised, then disintegrated, their bodies turned into coal and oil, with bodily gases forming pockets under the sea. These substances were then harvested, refined and burned, with the chemical energy now being converted into heat (some of it back into light), then kinetic energy, then electrical energy. See the image below to illustrate the point.