The process by which dead remains plants and animals are preserved as fossils is known as fossilization.
When a plant or an animals dies, their remains falls on the ground. Over a period of time their body gets covered by sediments brought by rivers, winds etc. These sediments keep on getting accumulated for over hundreds of years and when that land gets eroded, the fossils can be seen clearly. Thus, the process of accumulation of dead remains of plants and animals for over hundreds of years results in the formation of fossils.