The ocean appears blue because it absorbs colors at the red end of the light spectrum and reflects and scatters blue light. When sunlight enters the ocean, it is made up of various colors of light, each with a different wavelength. Water absorbs longer wavelengths (such as red, orange, and yellow) more effectively, allowing the shorter wavelengths (blue and violet) to be scattered in all directions.
This scattering is similar to how the sky appears blue due to the scattering of sunlight by air molecules. However, the ocean often appears more blue than the sky because water absorbs the red, yellow, and orange wavelengths, leaving predominantly blue light to be seen.