Magnesium-ion batteries (MIBs) are regarded as a promising alternative to lithium-ion batteries (LIBs) due to their material abundance, cost-effectiveness, and improved safety. The development of high-performance anode materials is crucial for the advancement of MIBs. In this work, the feasibility of boron-doped graphene/blue phosphorene heterojunctions BiGr/BP (i = 0, 1, 2, 3, 4) as potential anode materials for MIBs is systematically investigated using the density functional theory. Our results show that the average binding energies of BiGr/BP (i = 0, 1, 2, 3, 4) are negative, suggesting their suitability for experimental synthesis. The analyses of band structure and density of states reveal that BiGr/BP (i = 0, 1, 2, 3, 4) exhibit high conductivity, as the 2p orbitals of carbon and boron dominantly contribute to the density of states at the Fermi level. Magnesium (Mg) adsorption capacity rises with the increase of boron doping concentrations, indicating stronger interactions between the heterojunctions and Mg. At the highest doping concentration (i = 4), the adsorption energy of Mg adsorbed in the interlayer is –3.38 eV, demonstrating substantial potential for Mg storage. The ab initio molecular dynamics (AIMD) simulations at 300 K show minor fluctuations in total energy, confirming the thermal stability of B4Gr/BP. Climbing image nudged elastic band (CI-NEB) method is used to determine two diffusion pathways of Mg in the B4Gr/BP interlayer. Along Path II, the maximum diffusion barrier is 0.47 eV, suggesting rapid Mg diffusion in the B4Gr/BP interlayer. The average open-circuit voltage is 0.37 V, ensuring the safety of the charge-discharge process. The theoretical capacity is 286.04 mAh/g, which is twice that of the B4Gr/MoS2 system. In summary, boron doping significantly enhances the Mg storage capacity. Specifically, B4Gr/BP appears to be a promising candidate for high-performance anodes in MIBs, owing to its excellent stability, conductivity, Mg storage capacity, and electrochemical properties.