H4 is one of the four most common tyres of car headlight bulb. That range also comprises H1, H3 and H7 bulbs too, as well as the H4 variety.
In general, think of car bulbs the same way as you would with bulbs in light fittings at home, with a code that identifies the socket (aka cap or fitting) they are designed for. With vehicle lights, the code, in this case H4, identifies the configuration of prongs that allow the bulb and fitting to work together.
H4 is unique among this family of headlight fittings in that it is a dual filament bulb. The filament is the thing strand of metal (wire) that electricity passes through to create the light. Dual filament means that there’s two wires in one bulb, a huge space saver in the headlight unit. It’s also convenient to be able to replace one bulb and know that you’re driving with beams (full beam and dipped beam) in top condition. The downside of course, is when one fails, both much be replaced.
You might see various similar bulbs with different codes on the market. The most common are HB2 and 9003. Generally speaking, these are interchangeable in the sense that they’ll work perfectly in an H4 socket in place of an H4 bulb, but they’re obviously not the same as they’ve got a different number assigned to them. The reason for the variations in otherwise similar bulbs is to meet different legal requirements around the world (for example the United States) where the bean patterns are (historically) very different to the UK. For that reason, it’s wise to stick to an H4 bulb in an H4 socket to be sure of legal compliance.