How do foam extinguishers work?

Firstly, they are mainly water-based and so have the same cooling effect as water extinguishers, putting the fire out by lowering the temperature.
Secondly, they contain ‘Aqueous Film Forming Foam’ (this is why they are also known as AFFF foam extinguishers).

AFFF works by smothering the fire and sealing in the flammable vapours. This prevents the fire re-igniting. It also allows foam fire extinguishers to put out flammable liquid fires, by creating a barrier between the liquid’s surface and the flames.