The fluorescence intensity of N, S co-doped graphene quantum dots (N, S-GQDs) can be quenched by Fe3+ and Hg2+. Density functional theory (DFT) simulation and experimental studies indicate that the fluorescence quenching mechanisms for Fe3+ and Hg2+ detection are mainly attributed to the inner filter effect (IFE) and dynamic quenching process, respectively. The electronegativity difference between C and doped atoms (N, S) in favor to introduce negative charge sites on the surface of N, S-GQDs leads to charge redistribution. Those negative charge sites facilitate the adsorption of cations on the N, S-GQDs’ surface. Atomic population analysis results show that some charge transfer from Fe3+ and Hg2+ to N, S-GQDs, which relate to the fluorescent quenching of N, S-GQDs. In addition, negative adsorption energy indicates the adsorption of Hg2+ and Fe2+ is energetically favorable, which also contributes to the adsorption of quencher ions. Blue fluorescent N, S-GQDs were synthesized by a facile one-pot hydrothermal treatment. Fluorescent lifetime and UV-vis measurements further validate the fluorescent quenching mechanism is related to the electron transfer dynamic quenching and IFE quenching. The as-synthesized N, S-GQDs were applied as a fluorescent probe for Fe3+ and Hg2+ detection. Results indicate that N, S-GQDs have good sensitivity and selectivity on Fe3+ and Hg2+ with a detection limit as low as 2.88 and 0.27 nM, respectively.