Fire is a chemical reaction - rapid oxidation releasing heat and light. The heat keeps the reaction going, causing more oxidation. Remove any element - fuel, oxygen, heat - and the fire goes out.
That's what fire extinguishers do - they remove heat or oxygen or block the fuel.