tl;dr
- To combat detonation (in SI engines)
- To increase power/efficiency
Details
There are a few important factors at play here.
Engine detonation is a real concern for SI engines
A spark-ignition engine is more likely to experience premature ignition (aka knocking or detonation) with hotter air. In fact, the calculations in the example below can show that this is the primary reason why intercooling is such a Good Idea.
Hot air rises, cold air sinks
In physics-speak, hot air is less dense than cold air. This means that the volume occupied by 1 kg of hot air is greater than the volume occupied by 1 kg of cold air.
The internal combustion engine is a volumetric device
What this implies is that every time the engine turns over and completes a cycle, the volume of air that is admitted into the combustion chamber(s) is fixed.
Power depends on mass, not volume
The power developed by the engine is proportional to the mass of air admitted into the combustion chamber and not its volume. More air molecules = more bang.
The reason why turbochargers (or any other forced-induction devices) are utilized is to increase the power and/or efficiency of the IC engine. At combustion chamber level, this is achieved by increasing the amount of air molecules present during combustion.
The turbocharger achieves this by pressurizing the incoming air. An unwanted by-product of this compression process is that the outgoing air is hot and less dense.
If this hot air is fed to the combustion chamber as-is, the likelihood of engine detonation is greater.
By cooling the air via an intercooler, engine operation being safer since engine knock is reduced.
As an added bonus the air becomes slightly denser, enabling more air molecules to be present during combustion.
Bonus Example
This is one of those questions where numbers can speak louder than words:
Forums indicate that a stock Mitsubishi Evo X is capable of generating 22 psi boost at mid-range RPM.
At sea level, the turbo inlet conditions are as follows:
Air pressure @ turbo inlet = 14.7 psi
Assumed inlet air temperature = 25 °C
=> air density @ turbo inlet = 1.184 kg/m^3
Assuming 85% turbocharger efficiency, engineering calculations1 will yield a discharge temperature close to 92 °C:
Air pressure @ turbo outlet = 14.7 + 22
= 36.7 psi
Air density @ 36.7 psi, 92 °C = 2.41 kg/m^3
Were it not for the fact that we care about detonation, the outlet density value looks rather tasty - it is more than double that of the inlet.
But look what happens when we run this hot discharge air through an intercooler.
Let's assume a 1 psi drop in pressure, and that the air is cooled down to 70 °C:
Air density @ 35.7 psi, 70 °C = 2.50 kg/m^3
Despite the fact that we lose precious boost through the intercooler, the cooling effect ends up increasing the density by over 3%, so now the air is denser, and, more importantly, safer from an engine knock/detonation standpoint.
1 - I have worked out a truly marvelous calculation for this, which this margin is too narrow to contain