Take a look at this picture:
Where did all the dirt come from that covered up each layer of representative life?
If you drop dead right now and left your body to nature, you won't end up underground like fossils. Scavengers will pull you apart and eat you, you will rot and the rains and ravages of time will remove all traces of you. Even if you were buried at a funeral, you won't become a fossil.
The conditions needed for you to become a fossil are very specific and thus rare. You need to die in a way that scavengers can't reach you, you'll be left alone, and you will be covered by silt or sediment before your bones decompose. This is easier on the bottom of the sea than on land, but sometimes there are places, such as a river delta where erosion and rains wash down the right amounts of the right kinds of silt, and the right kind of geology where the land is sinking so that the sedimentary system will continue for a long time, and a bunch of other factors.
As silt and sediment continues to build up above, and your layer continues to sink, the layers below get squeezed, and over ages become sedimentary rock. If all the variables are perfect (extremely rare) your bones can mineralize as they degrade, leaving behind an impression of their shape, made out of a kind of rock that is different from the surrounding rock - a fossil.
Over more ages, geology might change (continental plates push into reach other, etc) and start pushing those layers of rock up, or sideways, or pushing up ocean floor, including layers of rock below it that once were the floor.
Basically, the rock above and below is sedimentary and was being formed when you wandered into it in such a way that your shape was cast like a mold. Then geological forces over eons can shift areas of the Earth's crust, including pushing up those layers of rock formed out of ancient sediments