There are several ways to give an object potential energy. One can move the object against the force of gravity to increase. One can also stretch an object out or put pressure on it.
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.