Hydrocarbon generation is the process through which organic matter, primarily from ancient marine microorganisms, is transformed into hydrocarbons under high pressure and temperature over geological time scales. This transformation occurs in sedimentary basins and is a crucial step in the formation of oil and natural gas reserves.