Why are the oceans blue?

Pure water, because of the nature of oxygen-hydrogen bonds in the water molecules, absorbs
more of the longer wavelengths of the visible spectrum of the light which is the wavelength of red light.
On the other hand water absorbs much lesser of the shorter wavelength of light which is the wavelength of blue light.
This effect becomes visible in large quantities of water as a lake or ocean. Water in a water glass or a bucket of water
is much lesser so this effect is not seen. As we dive underwater light becomes dimmer and dimmer and also bluish.

Different water bodies may have different hues because of the other compounds that are present in water - dissolved or suspended.
These will scatter or absorb visible light at different wavelengths.