Coal deposits form from the fossilized remains of plants that lived in swampy forests millions of years ago. As these plants died, they sank to the bottom of the swamp and were covered by layers of mud and sand. Over time, the pressure and heat from these layers turned the plant matter into coal.