Cyanobacteria and their metabolites are one of the primary precursors of disinfection by-products (DBPs) in natural water environments. However, few studies have investigated whether the production of DBPs by cyanobacteria changes under complex environmental conditions and possible mechanisms underlying these changes. Therefore, we investigated the effects of algal growth phase, water temperature, pH, illumination and nutrients on the production of trihalomethane formation potential (THMFPs) by Microcystis aeruginosa in four algal metabolic fractions, that is, hydrophilic extracellular organic matter (HPI-EOM), hydrophobic EOM (HPO-EOM), hydrophilic intracellular organic matter (HPI-IOM) and hydrophobic IOM (HPO-IOM). Additionally, correlations between THMFPs and some typical algal metabolite surrogates were analyzed. The results showed that the productivity of THMFPs by M. aeruginosa in EOM could be affected significantly by the algal growth phase and incubation conditions, while the IOM productivity varied insignificantly. M. aeruginosa in the death phase could secrete more EOM and have a higher THMFP productivity than those in the exponential or stationary phases. Cyanobacteria grown under harsh conditions could have increased THMFP productivity in EOM by increasing the reactivity of algal metabolites with chlorine, for example, under low pH conditions, and secreting more metabolites in EOM, for example, under low temperature or nutrient limitation conditions. Polysaccharides were responsible for the enhanced THMFP productivity in HPI-EOM fraction, and a significant linear correlation was found between the concentration of polysaccharides and THMFPs (r = 0.8307). However, THMFPs in HPO-EOM did not correlate with dissolved organic carbon (DOC), ultraviolet absorbance at 254 nm (UV254), specific UV absorbance (SUVA) and cell density. Thus, we could not specify the kind of algal metabolites that contribute to the increased THMFPs in the HPO-EOM fraction under harsh growth conditions. Compared with the case in EOM, the THMFPs in IOM were more stable and correlated with the cell density and total amount of IOM. The results implied that the THMFPs in the EOM were sensitive to growth conditions and were independent of algal density. Considering the fact that traditional water treatment plants cannot remove dissolved organics as efficiently as algal cells, the increased THMFP productivity in EOM by M. aeruginosa under harsh growth conditions could be a potentially serious threat to the safety of the water supply.