The answer is they require sunlight to carry out photosynthesis.
Phytoplankton is basically a plant with only one cell. To obtain food, phytoplankton need to conduct a photosynthesis process just like normal plants do.
As the water got deeper, it would be harder for sunlight to pass through the water. So, most of the phytoplankton usually went to the surface in order to obtain the main source of their photosynthesis.