Okay, so imagine you have a bathtub and you want to clean it, but just using water won't do the trick. You need soap, right? Firefighting foam is like soap for fires.
Just like soap creates bubbles when you use it, foam creates bubbles too. But these bubbles are special because they are filled with air and water mixed together with special chemicals.
When firefighters use foam on a fire, they spray it out of a hose. The foam bubbles land on the fire and smother it, which means they cover it up and stop air from getting to it. Fire needs air to keep going, so when the foam covers it up, the fire runs out of air and has to stop.
Foam is really helpful because it can cover a big area and it can stick to things really well, like wood or metal or even oil and gasoline. Plus, it works on all kinds of fires, like ones in buildings or cars or out in the open.