A long-standing challenge in physics is to understand why cementite is the predominant carbide in steel. Here we show that the prevalent formation of cementite can be explained only by considering its stability at elevated temperature. A systematic highly accurate quantum mechanical study was conducted on the stability of binary iron carbides. The calculations show that all the iron carbides are unstable relative to the elemental solids, -Fe and graphite. Apart from a cubic Fe23C6 phase, the energetically most favorable carbides exhibit hexagonal close-packed Fe sublattices. Finite-temperature analysis showed that contributions from lattice vibration and anomalous Curie-Weis magnetic ordering, rather than from the conventional lattice mismatch with the matrix, are the origin of the predominance of cementite during steel fabrication processes.