As the name indicates, the fossil fuels are the fuel resources which are formed due to the buried remains of plants and animals over a period of million years. Examples of fossil fuels include coal and petroleum.
Coal was formed when trees and plants that grew in humid, swampy areas died and got buried in swampy soil, which were later covered by layers of the sediments for about 300-400 million years.
Petroleum was also formed in a similar manner due to the burial of marine organisms which died millions of years ago.