When air is quickly compressed, work is done on it. Its internal energy will increase, along with its temperature. The pump becomes warm because you compressed the air within it. On the other hand, when you release air from a pressurized tire, the expanding air performs work on its surroundings. The air's internal energy decreases, along with its temperature. This cools the tire valve in the process.
Work Step by Step
Both of the above are adiabatic processes, and the situation is described on page 341.