CO2 is a common agent in fire extinguishers, which suppresses fire. How does this same chemical contribute to global warming when it also puts out fires?
It seems that you are wondering how a chemical that prevents heat (putting out a fire) can also cause heating (global warming). These two things happen through unrelated processes.
Fire extinguishers that use CO2 act by displacing oxygen. The CO2 doesn't directly interact with the fire but just takes up space so that oxygen cannot interact with the fire. There is a secondary effect that the CO2 exiting the extinguisher is cooler than the air it is displacing so it helps to remove heat from the fire (by putting it somewhere else). These are reasons that CO2 extinguishers are not suitable for all kinds of fire suppression, particular for fires that have oxidizers and do not rely on atmospheric oxygen for combustion.
The contribution to global warming from CO2 (and all other greenhouse gases) is a radiative effect. Every molecule has specific frequencies of electromagnetic radiation they absorb and emit. The earth (and all things) emit electromagnetic radiation based upon its surface temperature. This energy would be lost to space (cooling the earth) except that the greenhouse gases absorb radiation at the same wavelengths the earth emits at. This means that, e.g. CO2, intercepts this energy headed for space and instead absorbs it, causing the CO2 to warm up a little. This CO2 also emits radiation but will emit less than it absorbs (and some of its emission is back toward the earth, not space), so there is a net energy gain due to atmospheric GHG, which causes warming.
As you can see, the mechanisms that CO2 contributes to global warming and fire suppression are unrelated (radiative vs displacement) which is why this molecule can be used in these seemingly contradictory applications.