Because mercury can be a gas, liquid, or solid, and because its properties include high conductivity and liquidity at room temperature, there are a whole host of applications in which it is useful. This includes being used in some types of thermostats.
Unfortunately, those same great properties can also make mercury a problem in the environment.