Municipal sludge (MS), rainwater sludge (RS), and kitchen waste (KW) were used as nutritional supplements for black soldier fly larvae (BSFL). Cd (52.3 %) was more easily assimilated in the BSFL body than Cu (34.8 %). After biotransformation in BSFL, the weak acid-soluble fraction (F1) of Cu and Cd increased by an average of 29.0 % and 42.7 %, respectively, whereas the reducible fraction (F2) of Cu and Cd decreased by an average of 13.8 % and 56.4 %, respectively, in the BSFL sand (BSFL feces and waste residues). A significant correlation (P < 0.01) was found between pH and the speciation of Cu and Cd. The abundance of Bacteroides had a positive correlation (P < 0.05) with the F1 of Cu, an extremely significant negative correlation (P < 0.001) with the F2 of Cd, and an extremely significant positive correlation with the F1 of Cd (P < 0.001). In addition, Cu and Cd exposures significantly (P < 0.01) reduced larval weight by 67.7 % and 45.3 %, respectively, pupation rate by 46.3 % and 26.5 %, respectively, and eclosion rate by 35.5 % and 33.4 %, respectively. Exposure to high concentrations of Cu and Cd also prolonged the development cycle (1–12 days) of BSFL and led to the failure of BSFL to complete their metamorphosis.