Wavelengths of light pass through matter differently depending on the material’s composition. Blue wavelengths are transmitted to greater depths of the ocean, while red wavelengths are absorbed quickly. Water molecules scatter blue wavelengths by absorbing the light waves, and then rapidly reemitting the light waves in different directions. That is why there are mostly blue wavelengths that are reflected back to our eyes.
Sometimes oceans look green. This may be because there is an abundance of plant life or sediment from rivers that flow into the ocean. The blue light is absorbed more and the yellow pigments from plants mix with the blue light waves to produce the color green.
Sometimes parts of the oceans will look milky brown after a storm passes. This is because winds and currents associated with the storm churn up sand and sediment from the rivers that lead into the oceans.
The ocean may also reflect the blue sky. However this is prominent only at relatively low angles and when the water is smooth.
So when white light from the sun enters the ocean, it is mostly the blue that gets returned. Same reason the sky is blue."