Gold suggested that hydrocarbons are formed from primordial methane upwelling from the inner crust and that bacteria evolved that could feed on these hydrocarbon and oxygen from the surrounding rocks.
It's just "stuff" composted underground w/o O2, mostly dead plantlife.
Lab guys will tell you many of it's molecules resemble leaf waxes.