Owing to metallic conductivity, tunable surface chemistry, mechanical flexibility, high surface area and chemical stability, MXenes have emerged as promising candidates for room-temperature gas sensors. In this study, gas sensing performances of the newly synthesized Hf3C2 MXene with oxygen termination toward a wide range of common molecules (NH3, H2O, H2S, H2, CO2, CO, CH4, N2 and NO) were investigated by first-principles density functional calculations. With the most negative adsorption energy, the highest charge transfer and the shortest adsorption distance, the adsorption of NH3 among the investigated gases causes the most significant changes in electrical conductivity and work function of Hf3C2O2 substrate, thus holds the biggest gas response. Only the NH3 exhibits strong chemical interactions with Hf3C2O2, and other gas molecules are weakly chemisorbed or physisorbed. All these indicate that Hf3C2O2 exhibits high selectivity and sensitivity to NH3. The adsorption energy of NH3 falls within the appropriate range for room-temperature gas sensors, enabling Hf3C2O2 to maintain NH3 sensitivity while also achieving a fast recovery time. Furthermore, giving that human exhaled breath does not affect, and may even enhance, the selectivity and sensitivity of Hf3C2O2 towards NH3, Hf3C2O2 can serve effectively as an NH3 sensor in human disease detection.