Industrialization has brought many environmental problems since its expansion, including heavy metal contamination in water used for agricultural irrigation. This research uses microbial fuel cell technology to generate bioelectricity and remove arsenic, copper, and iron, using contaminated agricultural water as a substrate and Bacillus marisflavi as a biocatalyst. The results obtained for electrical potential and current were 0.798 V and 3.519 mA, respectively, on the sixth day of operation and the pH value was 6.54 with an EC equal to 198.72 mS/cm, with a removal of 99.08, 56.08, and 91.39% of the concentrations of As, Cu, and Fe, respectively, obtained in 72 h. Likewise, total nitrogen concentrations, organic carbon, loss on ignition, dissolved organic carbon, and chemical oxygen demand were reduced by 69.047, 86.922, 85.378, 88.458, and 90.771%, respectively. At the same time, the PDMAX shown was 376.20 ± 15.478 mW/cm2, with a calculated internal resistance of 42.550 ± 12.353 Ω. This technique presents an essential advance in overcoming existing technical barriers because the engineered microbial fuel cells are accessible and scalable. It will generate important value by naturally reducing toxic metals and electrical energy, producing electric currents in a sustainable and affordable way.