The commercial coconut shell-activated carbon was modified to change the number of oxygen-containing functional groups. N2 adsorption/desorption isotherms, Fourier transform infrared (FT-IR), and Boehm titration were adopted to describe the physical and chemical properties of the samples. The adsorption isotherms of CO2 and CH4 on both the unmodified and modified samples were measured. To better understand the effects of surface oxygen-containing functional groups on adsorption of CO2 and CH4, the overall adsorption could be considered as the result of adsorption within the pores and adsorption onto the oxygen-containing functional groups. Thus, a new way to understand different adsorption mechanisms by calculation was proposed. On the basis of the results, there is a significant correlation between the saturation adsorption capacity of CO2 and the number of oxygen-containing functional groups, especially carboxyl and hydroxyl. According to the values of enthalpy (-12.2 to -20 kJ/mol), it can be known that the adsorption caused by oxygen-containing functional groups is exothermic and belongs to physisorption. A semiempirical relationship between the variation of the surface oxygen-functional groups and the variation of the adsorbed amount was established. The method proposed in this paper provides a new way to study the effects of surface functional groups on the adsorption of CO2 and CH4 and can be even promoted in studying the adsorption mechanism of other adsorbates.