This is because warm water is less dense than cold water. Think of it this way, if you were cold, then you'd try to get more warm by bringing yourself together. If you felt hot, then you'd spread your body parts out to not feel hot. So the same thing with molecules, if the water is warm then it's less dense. If the water is cold then it's more dense/tightly packed.