This question already has an answer here:
Why does the cabin air sometimes smell of jet fuel, although bleed air is tapped before it comes in contact with fuel ? How is this possible?
I have smelled this a couple of times in my life (twice extremely irritating), mostly during boarding/taxiing but at least once also during the flight (although in that case I don't remember if the smell was already present before take-off and merely lingered on).
Apparently a similar observation was reported in Q25405 but limited to the taxiing phase, whereas I witnessed the smell when the plane was still connected to the PBB (and also in-flight with the caveat above). The root cause may differ.
Meanwhile, I have found a satisfying answer on the net, but cannot add it anymore since the question is closed:
« You’ll occasionally notice a strong odor when the plane is on the ground – a pungent smell similar to the exhaust from an old car or bus that fills the cabin shortly after pushback. Usually this happens when exhaust gases are drawn into the air conditioning packs during engine start. The wind is often to blame, causing air to backflow or blowing fumes through the pack inlets. It normally lasts only a minute or so, until the engine is running and stabilized. It’s unpleasant but little different from the fumes you occasionally breathe in your car while stuck in traffic. » (source)
(Notice that in my cases it lasted definitely much longer than "only a minute or so".)