I assume that you are talking about what happens when air sinks within the atmosphere. This is the process, for example, that helps to create the eye of a hurricane.
The reason that air compresses as it sinks is that there is more air pressure lower down in the atmosphere. Down at the bottom of the atmosphere where we are, the air is being compressed by all of the air above it in the atmosphere. If the air were higher up, there would be less air pushing down on it and compressing it. So, as the air sinks, there comes to be more air pressing down on it and it compresses.
Pressure, volume and temperature are interrelated. Volume is inversely proportional to the density. Air has mass and weight and, therefore, pressure at a point in the atmosphere depends upon the air column above. Thus the pressure is more at ground or sea level than on a hilltop. The sinking air pocket, therefore, has a density more than that of its surrounding air. So the sinking air pocket, as it comes down closer to earth has to have higher atmospheric pressure on it and this in turn reduces its volume and increases its density. The nature has a trick of distributing excess heat energy received from the sun on sea water, which evaporates taking the heat on the sea. The humid air thus possesses the heat energy and goes up and the wind makes the cold air sinks down. This convection helps heat energy flow above and far and wide on the globe.