We know that temperature decreases with increasing altitude. This is mainly due to convection currents in the troposphere - the lowermost (and most dense) region of the earth's atmosphere). As you know that the surface of the earth gets heated up on account of solar radiation and it also heats the air which is in immediate contact with the surface. This gives rise to convection currents which continuously transport air from lower region to higher ones and vice versa. When the air from sea level rises to the upper atmosphere of lower pressure it expands i.e. the volume increases. While expanding, the molecules push aside the neighbouring molecules. In doing so the molecules lose their kinetic energy and it is this energy loss which is reflected in a decrease in temperature. The same amount of energy is gained by the gas molecules when they are compressed while descending and thus the temperature increases. Such a change in temperature where no addition or substraction of heat takes place between the system and the surrounding is called adiabatic change.