A car can explode when on fire but only if the fire gets to the gas tank or there's a gas leak while the car is on fire and the fire reaches the ruptured gas tank or the leaking gas.
Cars don't always explode when on fire if the cars fire is put out soon enough before the fire reaches the gas tank.