In this paper, the effects of chloride ions, oxygen, and carbon dioxide on the corrosion resistance of passive films formed on 316 L stainless steel were investigated in the aggressive oilfield environment using electrochemical testing and microscopic characterization techniques. The results showed that Cl− accelerated the anodic dissolution of the metal and compromised the structure and densification of the passive film, thus reducing its corrosion resistance. An increase in the partial pressure of carbon dioxide initially promotes pitting, but subsequently inhibited further corrosion development. The presence of oxygen enhanced the cathodic reaction and passive film formation, effectively preventing the invasion of aggressive chloride ions, thus inhibiting further corrosion. These findings provide a significant scientific basis for material selection and protection of oil extraction equipment in oilfield environments.