In a reversible reaction, the reaction is exothermic in one direction and endothermic in the other direction. The position of equilibrium in a reversible reaction can be affected by changes in temperature.
In the reaction below, the forward reaction is exothermic while the backward reaction is endothermic.
2NO2 ⇌ N2O4
If the temperature increases, the position of equilibrium will shift to the endothermic direction, producing more NO2 gas. As endothermic reactions take in heat energy, this will reduce the temperature.
Whereas, if the temperature decreases, the position of equilibrium will shift to the exothermic direction, producing more N2O4 gas. As exothermic reactions give out heat, this will increase the temperature.