This is actually a phenomenon called the Mpemba effect, named after Erasto Mpemba who observed this effect while making ice cream. The Mpemba effect refers to the observation that under certain conditions, hot water can freeze faster than cold water.
The exact cause of the Mpemba effect is still not fully understood, and there are numerous proposed explanations, including evaporation of the hot water which reduces the amount of water that needs to be frozen, and convection currents in the initial stages of freezing that might be more efficient in hot water due to its lower viscosity. However, some studies have failed to replicate the Mpemba effect consistently, leading to ongoing debate and research in the scientific community.
It is...