What's the difference between CO2 and N2 used in food packaging?
In either case, this is referred to as "Modified atmosphere packaging", which means the food is packaged in something other than simply "air".
The point of doing this is that it increases the shelf life of the product.
When modifying the atmosphere inside of a package, the amount of oxygen can typically be reduced to 3% or less. Inert gases used for MAP are typically denser than oxygen. As such, the oxygen inside the package is forced out of the package. This results in extended product shelf life, product integrity, protection against discoloration, and for products like chips, a cushion-like buffer against damage (this is commonly referred to as a “pillow pack”).
Carbon dioxide (CO2)
Carbon dioxide inhibits the growth of most aerobic bacteria and molds. Generally speaking, the higher the level of CO2 in the package, the longer the achievable shelf-life. However, CO2 is readily absorbed by fats and water - therefore, most foods will absorb CO2. Excess levels of CO2 in MAP can cause flavor tainting, drip loss and pack collapse. It is important, therefore, that a balance is struck between the commercially desirable shelf-life of a product and the degree to which any negative effects can be tolerated. When CO2 is required to control bacterial and mold growth, a minimum of 20% is recommended.
Nitrogen (N2) Nitrogen is an inert gas and is used to exclude air and, in particular, oxygen. It is also used as a balance gas (filler gas) to make up the difference in a gas mixture, to prevent the collapse of packs containing high-moisture and fat-containing foods, caused by the tendency of these foods to absorb carbon dioxide from the atmosphere. For modified atmosphere packaging of dried snack products 100% nitrogen is used to prevent oxidative rancidity.
And additional clarity from the Wikipedia article on the subject:
The modification process often tries to lower the amount of oxygen (O2), moving it from 20.9% to 0%, in order to slow down the growth of aerobic organisms and prevent oxidation reactions. The removed oxygen can be replaced with nitrogen (N2), commonly acknowledged as an inert gas, or carbon dioxide (CO2), which can lower the pH or inhibit the growth of bacteria. Carbon monoxide can be used for preserving the red color of meat.