By compressing $\ce{CO2 (g)}$ the gas gains a lot of heat. When the hot compressed carbon dioxide is left to cool, it attains the temperature of the surrounding material. When it is released into the pressure outside (about 100kPa), it will get so cold (actual temperature depending on how much the carbon dioxide was compressed), that it will freeze (below 78.5 degrees celcius).
How much pressure is needed to make dry ice at 293K (20 degrees celcius)?