Most car accidents don't cause any fire or explosion but when the car does crash and catches on fire and eventually explodes it usually catches on fire due to a spark that catches fuel on fire due to a ruptured fuel line or the battery rupturing in the accident causing a fire because of a spark.
Or the battery shorting out itself.
Cars can also explode if the fire and heat gets to the gas tank and then it explodes.
But a car usually will catch on fire and burn for at least 30 minutes before it actually explodes.