The detection of ammonia (NH3)gas holds significant importance in both daily life and industrial production. In this study, the Nb2CTx/MoSe2 sensor was synthesized using a one-step hydrothermal method and applied for NH3 detection. The morphology and elemental composition of the composites were analyzed through a series of characterization techniques including XRD, TEM, SEM, and XPS, confirming the successful synthesis of Nb2CTx/MoSe2 composite with the optimal mass ratio. The sensing performance of the sensor for NH3 (0.1-100 ppm) was tested at room temperature (∼25 °C). The results showed that, compared to pure Nb2CTx, the sensor based on Nb2CTx/MoSe2 composite exhibited more stable baseline resistance, a 3.5-fold increase in response to 50 ppm NH3, and a reduction in response/recovery time by 56.4 s/32.1 s. Additionally, the sensor's response to NH3 (1 ppm, 50 ppm, 100 ppm) varied by less than 10 % over 90 days, demonstrating excellent stability. The sensing mechanism of NH3 by Nb2CTx/MoSe2 composite is attributed to the formation of a p-n heterojunction and surface charge transfer at the interface between p-type Nb2CTx and n-type MoSe2. Finally, the superior selectivity mechanism of the composite for NH3 was investigated using first-principles calculations. This work opens a new avenue for exploring the application potential of Nb2CTx MXene-based nanocomposites in NH3 detection.