The present study provides the first report of heterologous expression of phytochelatin synthase from Anabaena PCC 7120 (anaPCS) into the hairy roots of Artemisia annua. Transformed hairy roots of A. annua expressing anaPCS gene showed better tolerance to heavy metals, viz., arsenic (As) and cadmium (Cd) owing to 143 and 191% more As- and Cd-accumulation, respectively, as compared to normal roots with a bioconcentration factor (BCF) of 9.7 and 21.1 for As and Cd, respectively. Under As and Cd stresses, transformed hairy roots possessed significantly higher amounts of phytochelatins and thiols probably due to the presence of both AaPCS (Artemisia annua PCS) and anaPCS. In addition, artemisinin synthesis was also induced in transformed hairy roots under heavy metals stresses. In-silico analysis revealed the presence of conserved motifs in both AaPCS and anaPCS sequences as well as structural modelling of PCS functional domain was conducted. Interaction of AaPCS and anaPCS proteins with CdCl2 and sodium arsenate gene ontology analysis gave insights to anaPCS functioning in transformed hairy roots of A. annua. The study provides transformed hairy roots of A. annua as an efficient tool for effective phytoremediation with added advantages of artemisinin extraction from hairy roots used for phytoremediation.Supplementary InformationThe online version contains supplementary material available at 10.1007/s11816-021-00682-5.