why does decreasing the temperature of a liquid make it freeze
Water's density maximum is a product of the same phenomenon. Close to the freezing point, the water molecules start to arrange locally into ice-like structures. This creates some openness in the liquid water, which tends to decrease its density.