Catalytic properties of single-atom catalysts are very sensitive to the geometric interaction between metal sites and their supports. Their catalytic behavior is closely related to the local coordination environment of metal sites. Herein, Ga–N4, Ga–N5 and Ga–N6 coordinated structures were obtained by tuning the coordination environment of a gallium (Ga) single atom. The Ga–N4 structure preferred photocatalytic hydrogen reduction for hydrogen with ∼96.4% selectivity. In contrast, the Ga–N6 structure favored photocatalytic oxygen reduction for hydrogen peroxide (H2O2) with 100% selectivity. In situ infrared (IR) spectra and density functional theory (DFT) calculations verified that the Ga metal site was the active center in the Ga–N4 structure while the N site was the active center in the Ga–N6 structure. This study demonstrated the coordination number dominated catalytic selectivity over Ga–Nx switchable active sites, providing a new insight for the design of single-atom catalysts.