The “color” of the ocean is determined by the interactions of incident light with substances or particles present in the water. White light from the sun is made up of a combination of colors that are broken apart by water droplets in a “rainbow” spectrum. Large quantities of water, even in a swimming pool, would appear blue as well. When light hits the water surface, the different colors are absorbed, transmitted, scattered, or reflected in differing intensities by water molecules and other so-called optically-active constituents in suspension in the upper layer of the ocean.
The reason that open ocean waters often appear blue is due to the absorption and scattering of light. The blue wavelengths of light are scattered, similar to the scattering of blue light in the sky but absorption is a much larger factor than scattering for the clear ocean water. In water, absorption is strong in the red and weak in the blue and so red light is absorbed quickly in the ocean leaving blue. Almost all sunlight that enters the ocean is absorbed, except very close to the coast. The red, yellow, and green wavelengths of sunlight are absorbed by water molecules in the ocean.
When sunlight hits the ocean, some of the light is reflected back directly, but most of it penetrates the ocean surface and interacts with the water molecules that it encounters. The red, orange, yellow, and green wavelengths of light are absorbed and so the remaining light we see is composed of the shorter wavelength blues and violets.