This is an involuntary response following loss of consciousness by inert gas asphyxiation. Your body struggles and convulses, but nobody is home. He also tried to hold his breath as long as possible. They used a one size fits all mask rather than a sealed bag which is not the way to go, fucking Alabama. One very small opening in the seal and it becomes a much more drawn out process, which may or may not have been the case.
So, when an inert gas like nitrogen or helium goes into the lungs, it displaces all the oxygen. This causes the oxygen from your blood to
very rapidly diffuse into the low-oxygen environment in your lung. At very high concentrations of nitrogen, this is an extremely quick process. This deoxygenated blood then circulates all around your body, where it gathers up all the oxygen from your tissues and brings it back to the lung to be ripped out again. Basically causes your respiratory system to work in reverse.
Most human physiological systems for regulating breathing are governed by carbon dioxide concentration, not oxygen concentration. Your body has ways of detecting too much carbon dioxide, but it has no way to detect inert gas until
you're basically already unconscious. So if you just block an airway, this causes carbon dioxide buildup, which makes your blood and lung environment acidic as well as instilling panic and air hunger.
Done properly, inert gas is probably the most painless way to execute someone, outside blowing them up with dynamite, a nuke, or a shotgun blast to the brain.