Electromagnetic energy from the sun is transformed by plants to chemical energy. Plants died and were covered by water and sediment. Heat and pressure over the millennium transformed the dead organic material to coal, which when burned, releases ancient energy.