Why is cold water at the bottom of ocean and warm top?

The premise of your question is incorrect. In general, the ocean's temperature decreases as depth increases. The surface layer of the ocean is typically warmer due to the absorption of solar radiation, while the deeper parts are colder due to the lack of sunlight and the influence of cold ocean currents.
Copyright Wanderlust World © https://www.ynyoo.com