When organisms and plants died and sank to the bottom of swamps and oceans, brown soil-like materials called peat are formed. Over millions of years, the peat became covered with sand, clay and other minerals and the peat is converted into layers of sedimentary rocks. After a long time, different type of fossil fuels are formed.