The doping of heteroatoms can radically alter the electronic properties of graphene quantum dots (GQDs), thereby realizing the adjustment of optical properties of GQDs, and further significantly improving quantum yield (QY) and other issues. In this paper, a simple, low-consumption and pollution-free synthesis strategy of boron and nitrogen co-doped graphene quantum dots (BGQDs) were developed by pyrolysis carbonization of citric acid (CA), boric acid and urea. The B,N-GQDs synthesized by this method showed bright blue fluorescence with a relatively high QY of 17.16%. The selective specificity of B,N-GQDs for Hg2+ was mainly attributed to the strong electron affinity of Hg2+ itself, which enabled it to perform kinetic chelation with boron, nitrogen, oxygen and other functional groups in B,N-GQDs more quickly. Therefore, the fluorescence of B,N-GQDs aqueous solution can be significantly quenched by aqueous solution containing Hg2+ or true water samples. B,N-GQDs fluorescent probe had high sensitivity to Hg2+. Moreover, it can respond quickly in a wide range of Hg2+ concentrations from 1 to 300 μM. The linear relationship was best at a concentration of 0∼4 μM, (R2 = 0.99753), and the minimum detection limit can achieve 4.3 nM (S/N = 3). The recoveries of Hg2+ in true water samples were between 99.6% and 104%, which indicated that B,N-GQDs can be successfully applied to the detection of Hg2+ in true water samples.