To know first why the sea is blue it is essential to know why the sky is blue as there is a similar phenomena involved in both. The sky is blue as the particles existing in the atmosphere are reflecting the light of a shorter wavelength like blue after absorbing them. The absorbed light is later radiated and scattered. This phenomenon of scattering is called Rayleigh scattering. This scattered blue light reaches our eyes and hence the sky appears blue. But not all blue colors in nature are because of scattering.
The sunset and sunrise color being red or orange is also because of Tyndall effect or Rayleigh scattering. But the blue color of the sea is due to two reasons.
1. When sunlight strikes the water, the longer wavelength light nearer to red color are absorbed and the shorter wavelength light is reflected back. The blue light also travels further deeper into the sea and gets reflected. But blue light also cannot travel beyond 200meters. As no light can pass deep into the sea, deeper waters appear black. The color of waters at the top of the sea is light blue and as we go still deeper the blue color becomes still darker due to many reflections and at the end becomes black.
2. Another reason why the sea appears blue is because the water droplets of the sea act as a mirror and reflects the color of the sky. If the sky is cloudless or if it is a clear sunny day, then water reflects blue color of the sky. This makes the sea water blue.
Some sea water also appears green if there are some algae and plant life. The green pigment in them will reflect green light and hence imparts green color to water. On cloudy days, the sea might appear gray in color.