Using the SENKIN code of CHEMKIN chemical kinetics package, and adding the models of heat transfer from the cylinder wall and the piston moving, the single-zone model which can numerical simulate the homogeneous charge compression ignition (HCCI) engine was built. At the same time, the detailed reaction mechanism of methane was adopted. The characteristics of NOx and N2O formation and effect factors (such as excessive air coefficient, and initial temperature) were simulated through this model. The results show that the major part of NOx is NO, the mole fraction of N2O is less. For the lean premixed HCCI engine, N2O reaction pathways play an important role for NOx formation. At the same time, the excessive air coefficient and initial temperature will affect the formation of NOx, but have less effect on the formation of N2O.. With the excessive air coefficient increasing or the initial temperature decreasing, the emissions of NOx are decreased, but the emissions of N2O remain constant.