According to Kevin Kelly there are 3 possibilites…
1. Oil comes from algae “The conventional wisdom is that oil descends from algae from eons ago. Lots and lots of algae. Unimaginable mounds of dead algae in quantities no longer found on this planet, pressed, and cooked into hydrocarbon liquids.”
2. Oil is abiogenic (non-organic) “Others, notably the Russians, have an alternative theory that oil comes from non-biological carbon compounds deep in this planet, like the methane oceans we find on other planets.”
3. Oil is produced by bacteria “An emerging third theory is that bacteria living within rocks produce oil. In this theory there is a biological component (the bacteria) which constitute the oil-generating process, but the originating material in not degraded organic material, but rather geological carbon gases.”