Carbon dioxide would probably work too.
Actually, no, CO2 wouldn’t work well. Your body can actually detect high concentrations of CO2 and reacts to it in a negative fashion. Hence using a CO2 chamber would likely work up the ‘cruel and unusual punishment’ angle. Nitrogen is the vast majority of the air we breath, so people are made to ignore it in high concentrations.
The reason I’ve been in favor of the nitrogen chamber for quite a while now (after reading an article with the suggestion some years ago), it is that is simply works, is cheap, and gets rid of any negative spectacle. The point of the death penalty is to put the perp down permanently, not to engage in any kind of cruelty. Nitrogen does this cleanly and cheaply. Honestly I’m amazed at how long it has taken for someone to adopt this. Considering how much more bother lethal injection actually is, there’s just no logic in it having taken this long.
The human body's "suffocation alarm" is triggered by high levels of CO2. CO2 would generate a panic attack, and unwelcome drama. Your body doesn't sense low levels of O2, just excessive levels of CO2.
CO2 triggers a response in the human body that causes a panic “I’m drowning” response. Pure nitrogen does not cause the same response.
It would "work," but the person being executed would have strong choking feelings, as the CO2 in their bloodstream built up. Nitrogen asphyxiation doesn't lead to choking feelings. People can die of nitrogen asphyxiation neer realizing that anything's wrong.