• The change of SiO x content leads to a shift in capacitive deionization performance. • CDI device positive and negative electrodes simultaneously remove anions and cations. • The biochar electrode itself achieves up to 90.71 % heavy metal removal efficiency. • The electrode maintained high removal efficiency in real aqueous matrices. • Machine learning models predicted a fluoride adsorption capacity of 79.28 mg g -1 . The composition of biochar was a critical factor governing its performance.