Why is the ocean blue and for that matter, why is the sky blue are both very good questions and are related to the fundamental physics of how light interacts with molecules and particles. But the two reasons are very different!
When you look at the ocean, what you see is the light that is reflected back to your eyes. Sunlight entering the ocean has all the colors of the rainbow - it is considered "white light." Once it enters the ocean, the light can be scattered by water molecules or by particles. When molecules or particles scatter light, it is reflected in many different directions.
The light can also be absorbed by water and particles like small algae that live in the ocean. If there are not many algae particles, the main absorber of light is water. Water can’t absorb blue nearly as well as it can absorb other colors like green, yellow, and red. Since the green, yellow and red are absorbed by the water, then any light that is scattered back out of the ocean is most likely to be BLUE!
So why is the ocean sometimes green? When there are a lot of algae, they, like plants in the garden, contain chlorophyll and other substances that absorb blue and red. That leaves the green light to be reflected back to you.
The light that you see coming from the sky is scattered by air molecules. Air molecules do not scatter much light at long wavelengths. So green, yellow, and red light are not easily scattered. But blue light, which has short wavelengths, is scattered, so the entire sky appears blue.
— Greg Mitchell, research biologist, Integrative Oceanography Division