Carbon dioxide corrosion presents a significant challenge in the oil and gas field. This study simulates the corrosive environment characteristics of oil and gas fields to investigate the corrosion inhibition properties of three triphenylmethane dyes. The inhibitive performance and mechanisms of these dyes were analyzed through weight loss and electrochemical testing, revealing that crystal violet (CV) exhibited a superior inhibition effectiveness over malachite green (MG) and Fuchsine basic (FB). At a concentration of 150 ppm in a CO2-saturated 5% NaCl solution at 25 °C, CV achieved an impressive maximum inhibition efficiency of 94.89%. With the increase in temperature, the corrosion rate slightly decreased, and the corrosion rate was 92.94% at 60 °C. The investigated CV acted as a mixed-type corrosion inhibitor and its protection obeyed the Langmuir adsorption isotherm. The corrosion morphology was characterized by scanning electron microscopy (SEM), X-ray photoelectron spectroscopy (XPS), and confocal laser scanning microscopy (CLMS). Quantum chemical calculations and molecular dynamics simulations were employed to validate the corrosion inhibition mechanisms, providing guidance for the further application of these dyes in corrosion control.