Grand canonical Monte Carlo (GCMC) simulations were used to analyse the effect of -O-Li, -NH2, -SH, -F, -COOH, and -NO2 functional groups on the adsorption and separation of pure CO2 and a mixture of CO2 and CH4. The metal–organic framework (MOF) skeleton was structurally optimized using the Forcite and Dmol 3 modules. First, the GCMC method was employed to simulate the adsorption of pure CO2 by functionalized Mg-MOF-74 at 298 K and 10–3000 kPa. The results illustrated that -O-Li, -NH2, and -SH groups increased the CO2 adsorption below 101 kPa and followed the order Li-O-Mg-MOF-74 > NH2-Mg-MOF-74 > SH-Mg-MOF-74. When the pressure was >101 kPa, the adsorption capacity of Mg-MOF-74 was higher than that of functionalized Mg-MOF-74. Then, the adsorption capacity and selectivity of functionalized Mg-MOF-74 in the CO2/CH4 mixture were investigated at 298 K and 10–3000 kPa. The results showed that the introduction of -O-Li, -NH2, and -SH groups increased the CO2 selectivity of Mg-MOF-74 within the range of 10–1440 kPa and followed the order Li-O-Mg-MOF-74 > NH2-Mg-MOF-74 > SH-Mg-MOF-74.