The wettability of mineral surfaces has significant impacts on transport mechanisms of two-phase flow, distribution characteristics of fluids, and the formation mechanisms of residual oil during water flooding. However, few studies have investigated such effects of mineral type and its surface wettability on rock properties in the literature. To unravel the dependence of hydrodynamics on wettability and minerals distribution, we designed a new experimental procedure that combined the multiphase flow experiments with a CT scan and QEMSCAN to obtain 3D digital models with multiple minerals and fluids. With the aid of QEMSCAN, six mineral components and two fluids in sandstones were segmented from the CT data based on the histogram threshold and watershed methods. Then, a mineral surface analysis algorithm was proposed to extract the mineral surface and classify its mineral categories. The in situ contact angle and pore occupancy were calculated to reveal the wettability variation of mineral surface and distribution characteristics of fluids. According to the shape features of the oil phase, the self-organizing map (SOM) method, one of the machine learning methods, was used to classify the residual oil into five types, namely, network, cluster, film, isolated, and droplet oil. The results indicate that each mineral’s contribution to the mineral surface is not proportional to its relative content. Feldspar, quartz, and clay are the main minerals in the studied sandstones and play a controlling role in the wettability variation. Different wettability samples show various characteristics of pore occupancy. The water flooding front of the weakly water-wet to intermediate-wet sample is uniform, and oil is effectively displaced in all pores with a long oil production period. The water-wet sample demonstrates severe fingering, with a high pore occupancy change rate in large pores and a short oil production period. The residual oil patterns gradually evolve from networks to clusters, isolated, and films due to the effects of snap-off and wettability inversion. This paper reveals the effects of wettability of mineral surface on the distribution characteristics and formation mechanisms of residual oil, which offers us an in-deep understanding of the impacts of wettability and minerals on multiphase flow and helps us make good schemes to improve oil recovery.