Developing high-efficiency photocatalysts for clean energy generation is a grand challenge, which requires simultaneously steering photocarrier dynamics and chemical activity for a specific reaction. To this end, here for the first time, we explore the real-time photocarrier transport property and catalytic mechanism of nitrogen reduction reaction (NRR) at the interface of bismuth oxyhalides (BiOX, X = Cl, Br, and I), an inexpensive and green semiconductor. By time-dependent ab initio non-adiabatic molecular dynamics simulations, we show that the separation and recombination processes of excited carriers as well as the catalytic activity can be concurrently optimized by precise band structure engineering. The exact influence of impurity states and heterojunction on the reduction power and lifetime of photogenerated carriers, light absorbance, and NRR activity/selectivity of BiOX are clearly unveiled, to provide essential physical insights for improving the photocatalytic efficiency of semiconductors for practical solar energy conversion and hydrogen fuel storage.