By in-situ corrosion observation and first-principles calculation based on density functional theory, the mechanism of the inclusion modification and the induction of corrosion with the rare earth element Ce is studied. The research includes the composition changes and main types of inclusions in steel during the modification process. The work function and the potential difference are calculated and the tendency of different Ce-containing inclusions to induce pitting corrosion is compared. Based on the above date, we discuss the influence of different atomic positions, atomic numbers, and different slab models on the work function. Finally, the mechanism of pitting corrosion induced in different crystal planes and different terminal planes of inclusions is clarified from the molecular point of view.