The energy in coal comes from energy that was stored in giant plants that lived hundreds of millions of years ago in swamp forests, even before the dinosaurs! When these giant plants and ferns died, they formedlayers at the bottom of the swamps. Water and dirt began to pile up on top of the dead plant remains.