This is all due to the Mpemba effect. The Mpemba effect is that water freezes faster when it is hot than when it is cold. You might think that since the cold water is closer to the freezing point, it must freeze fast, but that is not the case here! When you put cold water and hot water in the freezer at the same time, the hot water will always freeze first. This is all because the cold water will have dissolved gases or dirt in it. Dissolving means that the water breaks substances down. When things are dissolved in the water, it takes longer to freeze. Hot water has less of those dissolved materials, so it is able to freeze fast. That is why hot water freezes faster than cold water!!