This study investigated the spatiotemporal distribution of the phytoplankton in the coral habitat of Dongshan Bay (China), along with critical factors affecting the distribution, during June, August, and December 2022. Phytoplankton abundance in Dongshan Bay exhibited considerably temporal variation, peaking in June 2022, gradually decreasing thereafter, and reaching its lowest point in December 2022. The abundance of bottom-layer phytoplankton consistently exceeded that of the surface layer throughout all seasons. The average phytoplankton abundance in the coral habitat of Dongshan Bay was lower than that in non-coral habitat areas. Fluctuations in the Zhangjiang River and coastal upwelling influenced the diversity and community structure of the phytoplankton. Critical factors causing spatiotemporal variability in phytoplankton community structure included nutrient concentrations and seawater temperature. Nutrients played key roles in influencing various phytoplankton groups. Dominant diatom species, such as Thalassionema nitzschioides and Thalassiosira diporocyclus, were positively correlated with ammonia nitrogen, seawater salinity, coral cover, and the number of coral species present. In winter, Calanus sinicus exhibited a negative correlation with harmful algal bloom species. Additionally, it was found that both in the coral habitat and surrounding open sea, currents, nutrients, and zooplankton may play crucial roles in determining the spatiotemporal variability in the phytoplankton community structure.