Low-cost and high-efficiency catalysts are of crucial importance for the electrocatalytic hydrogen evolution reaction (HER). Two-dimensional (2D) boron nitride (B-N) compounds formed by the combination of boron and nitrogen atoms of group III and V elements are promising candidates for electrocatalytic HER due to their significant electronic properties. Hence, an electrocatalyst is computer-aided designed with isolated single atoms of 3d, 4d, and 5d transition metals supported on 2D B-N (B2N, B5N3, and B7N5) monolayers to fabricate single-atom catalysts (SACs) with an excellent HER performance. Moreover, pH modulations are considered to improve the HER activity theoretically based on first-principles calculation. Our results indicate that B-N compounds surface doping with transition metal atoms can effectively enhance the HER catalytic performance over a wide range of pH. Among all SACs studied, Co-, Ti-, V-, Nb-, Ru-, Tc-, Zr-, and Os-embedded B2N, Sc-, Cr-, Mn-, Ti-, and Y-embedded B5N3, and Sc- and Mn-embedded B7N5 have excellent catalytic activity under acidic conditions, while Mo-, Ir-, Re-, Ta-, and W-embedded B2N and Ti- and Fe-embedded B7N5 show high catalytic activity under alkaline conditions. Interestingly, Hf@B2N and V@B5N3 systems exhibit promising catalytic activity under acidic, neutral, and alkaline conditions. Our work offers cost-effective candidates with a wide pH range HER performance for exploring ideal electrocatalysts.