CO2 adsorption is one of the promising CCS technologies, and activated coke is a solid adsorbent with excellent adsorption properties. In this study, activated coke was prepared by using bituminous coal and coconut shells activated with KOH or CaCl2 in a physically activated atmosphere and modified with ammonia. The effect of the active agent impregnation ratio on the physicochemical properties of activated coke was investigated by N2 adsorption isotherms, scanning electron microscopy (SEM) and Fourier transform infrared spectrometry (FTIR). The CO2 adsorption performance of activated coke was tested, and the effect of nitrogen-containing functional groups on CO2 adsorption was investigated by experiments and simulations. The results showed that the specific surface area of activated coke reached 629.81 m2/g at a KOH impregnation ratio of 0.5 and 610.66 m2/g at a CaCl2 impregnation ratio of 1. The maximum CO2 adsorption capacity of activated coke reached 71.70 mg/g and 90.99 mg/g for conventional power plant flue gas and oxy–fuel combustion flue gas, respectively. After ammonia modification, the CO2 adsorption capacity of activated coke was further increased. Simulations showed that pyrrole and pyrrole functional groups changed the polarity of graphene and established weak interactions with CO2.