Algae and phytoplankton, but mostly algae. Not large creatures, generally. You'd get massive blooms with phyto/zoo plankton die-offs, they'd settle, then get buried in sand and sediment. Over centuries and millenia, you'd get cyclic deposits, creating massive accumulations, and then over geologic timeframes, you get pockets of striated deposits of these decomposing materials in high heat and pressure conditions. Once the deposits liquefy, they all flow into a common area.
Depending on the conditions and chemistry, you can get coal from ancient algal sources, but you can't get petroleum / liquid oil from ancient forests - the chemistry doesn't work out. You need lots of water and heat and pressure, single cell structures. Lots of cellulose and lignin means you don't get the liquefaction and mixing, forcing the material to carbonize and compress instead.
Depending on the conditions and chemistry, you can get coal from ancient algal sources, but you can't get petroleum / liquid oil from ancient forests - the chemistry doesn't work out. You need lots of water and heat and pressure, single cell structures. Lots of cellulose and lignin means you don't get the liquefaction and mixing, forcing the material to carbonize and compress instead.