Captain Tim Johnson, author of the History of Open-Water Marathon Swimming explains why it feel warmer in the shallow water, "Because of the shallow depth, the sun's rays penetrate the water and heat up the sand below so you have the surface water being heated by reflection and by accumulated heat from below."
"Shallow waters are definitely warmer than water with depth unless they are feed from an enclosed bay or river. In deeper water, you lose the sand blanket that has absorbed the heat. Now the same heat penetrates the ocean with deeper water, but because the rays penetrate to various depths (you lose the red wavelengths first) the heating is dispersed over a much wider area thus causing the cooler temperature."
World Open Water Swimming Association