We evaluated the geometrical, electrical, optical properties and charge transfer of pristine g-C3N4 (tri-s-triazine-based graphitic phase carbon nitride) B-doped g-C3N4 (doping of boron atoms into graphitic phase carbon nitride), m-BiVO4(001) surface (monoclinic bismuth vanadate (001) surface), g-C3N4/m-BiVO4(001) heterojunction and B-doped g-C3N4/m-BiVO4(001) heterojunction using density functional theory (DFT) simulations. Based on the findings, the synergistic impact of doping and heterojunctions on g-C3N4’s electronic properties as well as the photocatalytic mechanism of heterojunctions were analyzed. The doping of B atoms gives g-C3N4 a unique structure and reduces the effective mass of carriers, proving to be an effective way to increase electron transport capacity. The interfacial adhesion energy, binding energy, and interfacial distance all point to a van der Waals (vdW) interaction between g-C3N4 and m-BiVO4(001) surface. The findings demonstrate that the g-C3N4/m-BiVO4(001) heterojunction, in comparison to pristine g-C3N4 and m-BiVO4(001) surface, has a narrow bandgap, absorbs more photons and has a build-in electric field, all of which are advantageous for visible light-driven activity, the separation and transfer of charge carriers, and maintaining a strong redox ability. Additionally, the B-doped g-C3N4/m-BiVO4(001) heterojunction outperformed the g-C3N4/m-BiVO4(001) heterojunction in terms of visible light absorption efficiency, hydrogen production capacity, and interfacial charge density. The Z-scheme mechanism over the heterojunction has been proposed based on semiconductor theory to disclose the separation and transfer pathway of photogenerated charge during the photocatalytic water splitting process. The theoretical design provided here provides a theoretical reference for the efficient of g-C3N4-based photocatalysts for the efficient use of solar energy and the protection of the environment.