Sustainable management of contaminated biomass derived from phytoremediation of metal(loid) polluted soil and water is of great importance to avoid environmental risks from secondary pollution of the contaminants. In this regard, pyrolysis technology may reduce the environmental risk of the contaminants and produce different bio-products from contaminated biomass. In this work, slow pyrolysis of Avicennia marina biomass was conducted to compare the pyrolysis properties of heavy-metal-contaminated and uncontaminated biomass and its potential to generate pyrolytic products, such as biochar, bio-oil and pyrolytic gas at a varying temperature range from 300 to 800 °C. The results indicated that the properties of biomass and derivatives were affected significantly by both pyrolysis temperature and the presence of heavy metal(loid)s. The heavy metal(loid)s in biomass contributed to higher biochar and pyrolytic gas yields at the expense of bio-oil. Increasing pyrolysis temperature induced the volatilisation of heavy metal(loid)s in biochar samples. At the same pyrolysis temperature, the contaminants significantly increased the ash content whilst decreased the fixed carbon content in biochars (p < 0.05). Furthermore, it was noticed that the quality of bio-oils was improved by the presence of metal(loid)s, as the pyrolysis of contaminated biomass produced 8–11% hydrocarbons in the bio-oil samples with less oxygenated compounds as compared to uncontaminated biomass that produced only 4–5.8% hydrocarbons in the bio-oil. Moreover, biomass abound with trace metal(loid)s produced more H2 and CO2 during pyrolysis compared to uncontaminated biomass. Overall, this study demonstrated that pyrolysis is an efficient way for converting heavy metal contaminated biomass obtained from phytoremediation into valuable products, contributing to the sustainability of phytoremediation.