Coal is a non-renewable energy source because it takes millions of years to form.
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 formed layers at the bottom of the swamps.
Water and dirt began to pile up on top of the dead plant remains. Over thousands of years pressure and heat would build up on top of the plant remains, undergoing chemical and physical changes and pushing out the oxygen, turning these remains into what we call coal.