Abstract It is common sense the wettability alteration in carbonate reservoirs stems from the oil–rock interactions; however, the exact oil component acting as the dominant role remains unclear. This study adopts molecular dynamics technology, takes {101¯4} calcite crystal surface as the mineral surface of carbonate reservoir, uses multiple single-component oils to characterize real crude oil, and conducts research on the wettability alteration of carbonate reservoirs. First, based on the chromatographic analysis results of a certain carbonate reservoir in the Middle East, the simulated oil is divided into polar and nonpolar components. Then, the Materials Studio software and the COMPASS force field were employed to study the natural wettability of the calcite surface, as well as the adsorption characteristic of different oil components and water on the surface of calcite. Results show that the surface of calcite in carbonate reservoirs is indeed water-wet under initial conditions, and the contact angle of calcite surface is equal to 68.47 deg ± 3.6 deg. However, when the crude oil component contains groups of hydroxyl functional group, especially the strongly polar component with multiple hydroxyl functional groups, such as glycerol (GLYC), will cause the originally water-wet calcite surface becomes oil-wet. The main reason for the GLYC component altering the wettability of the calcite surface is hydrogen bonding and Coulomb interaction. Moreover, the results of centroid displacement of nine oil components shown that besides the GLYC component, the rest of the eight components, including the polar component of nitrogen-containing functional groups (Indole), sulfur-containing functional groups (Benzothiophene), as well as five nonpolar components, all migrate away from the calcite surface.