The adsorption mechanism of the branched quaternary ammonium salt Gemini surfactant (Gemini C3) at the water-surfactant-quartz interfaces for both neutral and negatively charged quartz surfaces was studied by a molecular dynamics (MD) method. Initial and final configurations, distributions of the surfactant and its interaction with surfaces, the radial distribution function (RDF) of water molecules, and the mean square displacement (MSD) of the surfactant in bulk phase have been elucidated at the molecular level. The results showed that the adsorption of Gemini surfactants onto the hydrophilic quartz surface was driven by electrostatic interaction, which increased the hydrophobicity of the solid surface when the surfactant concentration was lower than critical micelle concentration (CMC). However, the contact angle only slightly increased since the surface tension decreased simultaneously with growing concentration. Monolayers were formed during the adsorption process of Gemini C3 molecules on the quartz surface rather than a double layer when the concentration reached the CMC, indicating a gradual transformation of an extended monolayer adsorption configuration into a more compact one. The solid-liquid interfacial tension increased with the surfactant concentration and led to a significant increase of the contact angle. The simulation results were consistent with the experiments, which further revealed the microscopic adsorption mechanism of the Gemini C3 surfactant onto the quartz surface, and provided theoretical guidance for controlling the wetting properties and surface modification of the rock.