Coal spontaneous combustion (CSC) is a disaster that seriously threatens safe production in coal mines. Revealing the mechanism of CSC can provide a theoretical basis for its prevention and control. Compared with experimental research is limited by the complexity of coal molecular structure, the quantum chemical calculation method can simplify the complex molecular structure and realize the exploration of the mechanism of CSC from the micro level. In this study, toluene and phenylacetaldehyde were used as model compounds, and the quantum chemical calculation method was adopted. The reaction processes of the methyl and aldehyde groups with oxygen were investigated with the aid of the Gaussian 09 software, using the B3LYP functional and the 6-311 + G(d,p) basis set and including the D3 dispersion correction. On this basis, the generation mechanisms of CO and CO2, two important indicator gases in the process of CSC, were explored. The calculation results show that the Gibbs free energy changes and enthalpy changes in the two reaction systems are both of negative values. Accordingly, it is judged that the reactions belong to spontaneous exothermic reactions. In the reaction processes, the activation energy of CO is less than that of CO2, indicating that CO is formed more easily in the above-two reaction processes. In addition, the variations in concentrations of important oxidation products (CO and CO2) and main active functional groups (such as methyl, carboxyl and carbonyl) with temperature were revealed through a low-temperature oxidation experiment. The experimental results verify the accuracy of the above quantum chemical reaction path. Moreover, it is also found that the generation mechanisms of CO and CO2 in coal samples with different metamorphic degrees are different. To be specific, for low-rank coal (HYH), CO and CO2 mainly come from the oxidation of alkyl side chains; for high-rank coal (CQ), CO is produced by the oxidation of alkyl side chains, and CO2 is attributed to the inherent oxygen-containing structure.