A carbon quantum dot-based chitosan hydrogel was prepared in this work as a fluorescence sensor for the selective sensing of Hg2+ ions. Among the eight tested metal ions, the prepared hydrogel exhibited remarkable sensing selectivity and sensitivity toward Hg2+. The results demonstrated that a prominent fluorescence quenching at 450 nm was observed in the presence of Hg2+ with a linear response range of 0-100.0 nM and an estimated limit of detection of 9.07 nM. The as-prepared hydrogel demonstrates pH-dependent fluorescence intensity and sensitivity. The highest fluorescence intensity and sensitivity were obtained under pH 5.0. The excellent sensing selectivity could be attributed to a strong interaction between the hydrogel film and Hg2+ ions to form complexes, which provokes an effective electron transfer for fluorescence quenching. Results from density functional theory (DFT) calculation confirm that the interaction energies (IE) of the hydrogel with three toxic metal ions (Hg2+, Cd2+, and Pb2+) are in the following order: Hg2+ > Cd2+ > Pb2+.