FULL IN DEPTH ANSWER
this occurs because the hotter water is atoms are expanding and becoming lighter or in other words less dense but the cold water is still the same and it’s not expending instead its atoms are closer together because it’s cold so it’s denser or heavier then the hot water so the denser cold water would sink and the lighter hot water should float on top of the cold water
SUMMARY
SO ITS MOSTLY BECAUSE OF THE DIFFERENCE IN DENSITY IN THE HOT AND COLD WATER WITH THE HOT WATER BEING LESS DENSE THEN THE COLD SO IT FLOATS