Why is Mercury so hot and cold?

The planet Mercury does not rotate on an axis relative to the Sun. Consequently, the side facing the Sun is very hot while the back of the planet away from the Sun, never receiving warming sunlight is relatively cold. Or so it was thought, it has now been pr oven that Mercury does rotate, albeit very slowly. It is close to the sun and lacks a protective atmosphere