The corrosion phenomenon and its economic impacts can hardly be ignored in any application. This study synthesized a quaternary ammonium salt (3) containing hydrophobic dodecyl and electron-rich diallylbenzyl amine moieties to be used in 15 % HCl as a corrosion inhibitor of mild steel. Several techniques, such as 1H and 13C NMR, IR, TGA, and elemental analysis, have been used to characterize inhibitor 3. Popular corrosion measurement techniques, namely weight loss, potentiodynamic polarization techniques, and electrochemical impedance spectroscopy, have been used to determine the efficiency of inhibitor 3. At 303 K and a moderately low concentration of 50 ppm, the quaternary ammonium salt-based inhibitor demonstrated a maximum efficiency of ≈95.0 %. At elevated temperatures of 313, 323, and 333 K, the inhibition efficacy values were recorded as 91.3, 82.8, and 75.0 %, respectively. Adsorption isotherm study revealed that the adsorption of inhibitor 3 followed Langmuir adsorption isotherm. The value of ΔGads° was found to be – 40.19 kJ mol−1, indicating that inhibitor 3 became adsorbed via a mixed physi-chemisorption mechanism. A very high adsorption constant (Kads) of 1.53 × 105 L mol−1 suggested strong adsorption of inhibitor 3. The difference in activation energy (Ea) value of 42.4 kJ mol−1 between the control and the inhibited solution indicated an efficient adsorption of inhibitor 3. The ability of inhibitor 3 to retard both anodic and cathodic half-cell reactions was proved via open circuit potential and Tafel curves studies. Detailed discussions on the change in corrosion current densities (icorr), polarization (Rp) and charge transfer (Rct) resistances have been offered to discuss the inhibition efficiency. Water contact angle measurement showed a drastic increase in mild steel surface hydrophobicity following inhibitor 3 adsorption. SEM-EDX and XPS studies confirmed the definitive presence of inhibitor 3 on the mild steel surface. Density functional theory (DFT) studies revealed the frontier molecular orbitals with which the metal surface interacts. A detailed corrosion inhibition mechanism has been offered in the context of adsorption isotherm and DFT studies.