Why does CO2 deviate from ideal gas behavior?
For gases such as hydrogen, oxygen, nitrogen, helium, or neon, deviations from the ideal gas law are less than 0.1 percent at room temperature and atmospheric pressure. Other gases, such as carbon dioxide or ammonia, have stronger intermolecular forces and consequently greater deviation from ideality.
Sample Response: The attractive forces between CO2(g) molecules result in a pressure that is lower than that predicted by the ideal gas law. Since the particles are attracted to each other, they aren't colliding with the walls of the container as often as ideal gases with no attractive forces would.
CO2 molecule is quite large as compared to H2 and N2. The particles in CO2 will be closer to each other. So, there will be stronger van der waals attractions between the molecules of CO2 as compared to H and N which are small in size. More the interactions, more will be the deviation from ideal behaviour.
When you begin to compress the gas the molecules are compressed within range where these forces attract the molecules closer together and the volume is smaller than expected (your negative deviation from ideal gas).
Many gases such as nitrogen, oxygen, hydrogen, noble gases, some heavier gases like carbon dioxide and mixtures such as air, can be treated as ideal gases within reasonable tolerances over a considerable parameter range around standard temperature and pressure.
The deviation of real gas from ideal gas behaviour occurs due to the assumption that if pressure increases the volume decreases. The volume will approach a smaller number but will not be zero because the molecules will occupy some space that cannot be compressed further.
Gases deviate from the ideal gas behaviour because their molecules have forces of attraction between them. At high pressure the molecules of gases are very close to each other so the molecular interactions start operating and these molecules do not strike the walls of the container with full impact.
It is also good to know that ideal gas law assumes that the gas molecules have negligible/no size. Keeping that in mind, Xe is the largest of the bunch, and therefore is expected to have the greatest deviation of the ideal gas when under high pressure or low temperature.
Solution : `NH_(3)` is expected to show ore deviation because it cane easily liquefied being of polar nature. This shows that the attractive force in the molecules of `NH_(3)` are more than the forces present in `CO_(2)` molecules.
For gases such as CO2 and C2H4, they deviate more than other real gases because these gases tend to liquefy at lower pressures.
What does negative deviation from ideal behaviour mean?
(i) Z = 1, for an ideal gas. (ii) Z < 1, it is called negative deviation. It means that the gas is more compressible than expected from ideal behaviour. (iii) If Z > 1, it is called positive deviation. It means that the gas is less compressible than expected from ideal behaviour.
Carbon dioxide is a linear molecule while sulfur dioxide is a bent molecule. Both molecules contain polar bonds (see bond dipoles on the Lewis structures below), but carbon dioxide is a nonpolar molecule while sulfur dioxide is a polar molecule.

In case of real gas, PV ≠ nRt ∴ Z ≠ 1
When Z < 1, it is a negative deviation. It shows that the gas is more compressible than expected from ideal behaviour. When Z > 1, it is a positive deviation. It shows that the gas is less compressible than expected from ideal behaviour.
A gas behave more like an ideal gas at high temperature and low pressure as the potential energy due to less intermolecular force became less significant compared with the particles kinetic energy ,and the size of the molecule became less significant compared to the empty space between them.
Solution : `NH_(3)` is expected to show ore deviation because it cane easily liquefied being of polar nature. This shows that the attractive force in the molecules of `NH_(3)` are more than the forces present in `CO_(2)` molecules.
Polar molecules have stronger forces of attraction between molecules and so, they will deviate much more from ideality as compared to non-polar molecules.