A fire extinguisher filled with carbon dioxide puts out fires as the CO2 gas displaces oxygen. No oxygen, no more fire.
Magnesium is so reactive that it can actually react directly with carbon dioxide itself. In this video we start the reaction by lighting magnesium with a propane torch then enclose the burning metal in a block of dry ice (solid carbon dioxide).
The reaction between the magnesium and carbon dioxide gives off a stunning amount of light. Enough to light up the entire opaque block of dry ice.
Once the reaction stops we can open up the block and inside will be a small black ball of carbon coated with some greyish looking magnesium oxide, the final products of the reaction.