The most obvious way trees cool the air is by shading. Reducing the amount of sunlight striking buildings and pavement reduces the amount of energy that is absorbed and re-radiated into the air.
Trees also cool the air by a process known as 'transpiration cooling'. As trees release water into the atmosphere from their leaves via transpiration, the surrounding air is cooled as water goes from liquid to a vapor. The process is similar to evaporation pads used to cool greenhouses -- except in trees, water moves into the tree's roots from the soil and travels through the tree's water-conducting system, eventually being transpired from the leaves. The water that is released in its gas vapor form has a cooling effect on the surrounding air.