Developing and continuously optimizing measures to minimize and eliminate caffeine in the water environment is significant because of its wide distribution, persistence, and possible toxicity. Graphene oxide (GO) and graphene (GN) are two attractive carbon materials with excellent adsorption performance, and pH value plays an important role in these adsorption processes. In this work, a timely theoretical insight into the adsorption and removal of caffeine (an important pharmaceutical and personal care product) on GN/GO surface at different pHs was studied by molecular dynamics simulation. In the simulation process, it is found that GN has a good removal effect on caffeine, and pH has little effect on the GN_caffeine system due to the less changed adsorption types and interaction energy between GN surface and caffeine. For GO_caffeine systems, although all the added caffeine molecules are adsorbed at low pH, the interaction energy between GO and caffeine is reduced, the hydration around caffeine molecules is reduced, and the aggregation adsorption at high pH (especially pH>7) shows fragile aggregation structures. The adsorption stability of caffeine on the surface of GO decreases, and desorption easily occurs at alkaline conditions. This characteristic may be helpful to realize the in-situ regeneration of caffeine-saturated GO.