The g-C3N4/BiOCl (gCN-BCl) heterojunction photocatalyst was synthesized using a low-temperature precipitation method for effective photocatalytic degradation of carbofuran (CBF). All gCN-BCl composites demonstrate greater efficacy in removing CBF compared to its individual constituents. The synergistic effect of incorporating the 0D structured BiOCl onto the 2D structured g-C3N4 was comprehensively examined using various microscopic, X-ray, and spectroscopic analytical techniques. Additionally, optical and photoelectrochemical analyses were conducted. The findings validated that the interaction between the two semiconductors at the heterointerfaces enhanced remarkable physical and structural stability, promoted high charge separation and transfer properties, and improved photocatalytic degradation. Under optimal conditions, 5-gCN-BCl (0.25 g/L) achieved a CBF (5 mg/L) removal efficiency of 95.7 % under visible light irradiation of 120 min, achieving 3.1- and 5.9-times higher degradation rate than the pure BiOCl and g-C3N4, respectively. The radical trapping experiments indicated that the h+ and •O2− were the primary reactive species involved in the CBF degradation. Furthermore, the potential toxicity of CBF and its intermediates was assessed, revealing that the photocatalytic degradation process significantly lowered the ecotoxicity of pesticide wastewater. The potency of 5-gCN-BCl was also evaluated in tap water and real wastewater samples, with CBF degradation efficiencies of 85.8 %, 47.6 %, and 38.7 % in tap water, municipal, and pesticide industry wastewater, respectively. Additionally, artificial neural network (ANN) modeling was employed to predict and optimize the photocatalytic degradation process, providing further insights into the system’s performance. The outcomes of this work offer valuable insights into the development of heterojunction photocatalysts with superior stability and efficacy for eliminating pesticides from water bodies.