The ocean is blue because of the way it absorbs and reflects light. When sunlight hits the ocean, some of it is absorbed by the water, but most of it is reflected back up into the air. The color blue is reflected more than other colors because the water absorbs the other colors more easily.
Think about it like this: if you put a red shirt in a blue room, the shirt will still look red because the blue color of the room is not being absorbed by the shirt. But if you put that same red shirt in a red room, the shirt will look darker because the red color of the room is being absorbed by the shirt. The same thing happens with the ocean and the color blue.
The ocean also appears more blue on sunny days, when the sun is high in the sky and the light penetrates deeper into the water. On cloudy days, the light is scattered and absorbed more easily, making the ocean appear less blue.
So, the next time you look at the ocean and see its beautiful blue color, remember that it is because of how the water absorbs and reflects light.