Biochar has a wide range of feedstocks, and different feedstocks often resulted in different properties, such as element distribution and heavy metal immobilization performance. In this work, batch experiments were conducted to assess the effectiveness of biochar pyrolyzed from kitchen waste (KWB), corn straw (CSB), and peanut hulls (PHB) on immobilization of Cd and Pb in contaminated soil by planting swamp cabbage (Ipomoea aquatica Forsk.) with a combination of toxicological and physiological tests. The results showed that biochar could all enhance the soil pH, and reduce extractable Pb and Cd in soil by 22.61%-71.01% (KWB), 18.54%-64.35% (CSB), and 3.28%-60.25% (PHB), respectively. The biochar led to a drop in Cd and Pb accumulation in roots, stems, and leaves by 45.43%-97.68%, 59.13%-96.64%, and 63.90%-99.28% at the dosage of 60.00 mg/kg, respectively. The root length and fresh weight of swamp cabbage were promoted, while superoxide dismutase (SOD) and peroxidase (POD) decreased after biochar treatment. The distribution of heavy metal fractions before and after biochar treatment indicated that biochar could transform Cd and Pb into a state of lower bioavailability, thus inhibiting Cd and Pb uptake by swamp cabbage. Biochar with different feedstocks could be ranked by the following order according to immobilization performance: KWB > CSB > PHB.