The effectiveness of biochar as a sorptive material to remove contaminants, particularly heavy metals, from water is dependent on biomass type and pyrolysis condition. Biochars were produced from pulp mill sludge (PMS) and rice straw (RS) with nitrogen (N2) or carbon dioxide (CO2) as the purging gas. The sorptive capacity of the biochars for cadmium(II), copper(II), nickel(II) and lead(II) was studied. The heavy metal adsorption capacity was mainly affected by biomass type, with biochars adsorption capacities higher for lead(II) (109.9–256.4 mg g−1) than for nickel(II) (40.2–64.1 mg g−1), cadmium(II) (29.5–42.7 mg g−1) and copper(II) (18.5–39.4 mg g−1) based on the Langmuir adsorption model. The highest lead(II) adsorption capacities for PMS and RS biochars were 256.4 and 133.3 mg g−1, respectively, when generated using N2 as the purging gas. The corresponding lead(II) adsorption capacities were 250.0 and 109.9 mg g−1, respectively, when generated using CO2 as the purging gas. According to the intraparticle diffusion model, 30–62% of heavy metal adsorption was achieved in 1 h; film diffusion was the rate-dominating step, whereas pore diffusion was a rate-limiting step. Ion exchange and complexation between heavy metals and biochar surface functional groups such as carbonyl and hydroxyl groups were effective mechanisms for heavy metal sorption from the aqueous solution. We conclude that proper selection of both the feedstock type and the purging gas is important in designing biochars for the effective removal of potentially toxic metals from wastewater.