If fuel pumps in cars are located inside the fuel tank, isn’t there a major risk of fires originating from the tank?
In-tank electric fuel pumps are the most common types used today. The petrol is pumped from the tank to the engine compartment where it is fed to the fuel injection rail or, in some systems, to a high-pressure pump first. Fuel not used is returned to the tank.
The reason there is no risk of fire or explosion in the tank is that petrol by itself will not combust. A certain minimum quantity of oxygen (and heat) is necessary and this is not present in the fuel pump.
In the early days when you could “flood” the engine with fuel by continuously pumping the accelerator pedal, the engine simply refused to start because the ratio of fuel to oxygen exceeded the required combustible mix.
In the absence of oxygen, even if you immersed a red-hot piece of steel in a bowl of petrol, there will be no explosion or fire. Instead, the red-hot glow will be extinguished.
Do not try this at home, though, as you cannot simulate an oxygen-free environment.
Incidentally, shooting a bullet into a fuel tank is highly unlikely to cause an explosion for the very reason stated above. That happens only in movies.
Related story: Why do I need to replace my air filter?
Related story: Why are my auto headlights still on during the day?