Half-reaction of water splitting is hydrogen evolution reaction (HER), which requires low cost and high activity catalysts. Two-dimensional (2D) transition metal carbon/nitrides (MXene) materials have shown great potential as highly efficient catalysts due to their excellent properties. In this work, the heteroatom X (X = N, B, P, S) doping effect on the HER of M2C MXene (M = Ti, Mo) with or without oxygen functional groups have been performed by well-defined density functional calculations (DFT). The X doped M2CT2 (M = Mo, Ti; T = O) exhibited better HER catalytic activity than the X doped pristine M2C (M = Mo and Ti). Moreover, the calculated Gibbs free energies of hydrogen adsorption (ΔGH) indicate that the N-doped Ti2CO2 has improved electrocatalytic activity than that of Pt(1 1 1). Additionally, based on the electronic structure of X-doped Ti2CO2, the electrical conductivity of N-doped Ti2CO2 is higher than that of pristine Ti2CO2.