Heavy metals (HMs) are hazardous contaminants with persistence and bioaccumulation, attracting widespread attention. Wastewater treatment plants (WWTPs) play vital roles in the pollution control of sewage, closely related to human health and the biological environment. Therefore, eight HMs in three typical WWTPs of Nanjing were determined in this study. The results revealed that Cr, Ni, Cu, and Zn were high-level HMs in all WWTPs. Notably, the highest contents of high-level HMs were found in electroplating WWTP (EWWTP) influent among three WWTPs, probably causing their higher removal (19.34-55.32%) during their primary treatment. In contrast, most HMs could be removed in the secondary treatment stage of municipal WWTP (MWWTP) and industrial WWTP (IWWTP) with the highest removal of As (72.00-85.81%). Analogously, nutrients were mainly removed during the secondary stage, with superior performance in MWWTP. A decrease in HMs removal was observed in the tertiary treatment of MWWTP and IWWTP compared to the secondary stage, while higher HMs removal (0.51-29.15%) was found in EWWTP except Hg. The highest content of HMs in sludge was Zn and Cr, which was more abundant in EWWTP than other WWTPs. The results of Illumina Miseq sequencing demonstrated the inhibition of microbial richness and diversity of EWWTP and IWWTP by industrial wastewater. Besides, alterations of microbial community structure and components were also observed owing to various influent sources. More similarity was found between EWWTP and MWWTP, in which the abundance of dominant genera, including Saccharimonadales (7.60-9.56%), Raineyella (5.06-7.38%), and Thauera (2.48-4.45%) was much higher than IWWTP.