CO2 injection process has become one of the most effective development methods of shale oil reservoirs. Considering the widespread nanoscale pores in shale, the replacement dynamics of CO2 in such a small-scale pore can play a dominating role during the recovery process. In this study, combining the methods of static test and molecular dynamics (MD) simulation, the replacement mechanisms of CO2 in the nanopores of shale oil reservoirs are discussed. First, a series of static tests are performed to provide basic data for the molecular model development of shale oil and shale rock. Thus, from the test results, five different porewall molecular models are developed, include four inorganic porewall models (feldspar, calcite, montmorillonite, and quartz) and one organic porewall model (graphene). Simultaneously, two different shale oil molecular models (light shale oil model and heavy shale oil model) are also developed in this study. In order to confirm the accuracy of our MD simulation model, a series of wettability tests on the actual shale rocks are also carried out, and the results are compared against the results of MD simulations. Thereafter, a set of MD simulation runs are performed to address the replacement behavior of CO2 in nanopores. On the other hand, a concept of replacement efficiency (RE) is also proposed in this paper. Thus, the effect of shale oil composition, porewall mineral type and CO2 concentration on the replacement behavior can be analyzed. Results show that the CO2 replacement capacity of the inorganic porewall surfaces is the highest for calcite, followed by montmorillonite, and lowest for quartz and feldspar. In inorganic pores, RE increased significantly with the increase of CO2 concentration. And in organic pores, the change of CO2 concentration mainly affects the replacement effect of light oil. This study can provide some new insights to understand the replacement mechanisms of CO2 in shale oil reservoirs, which is important for the effective and efficient development of shale oil reservoirs.