316L and 304L stainless steels and a compositional gradient of both are fabricated using the same processing parameters via laser directed energy deposition additive manufacturing. In those alloys, the increase in chromium-to-nickel ratio is accompanied with grain refinement and formation of a high density of twin boundaries, i.e. Σ3 boundaries. By means of electron microscopy, crystallographic and thermodynamic calculations, we demonstrate that two mechanisms arising from the ferrite-to-austenite solidification mode are at the origin of twin boundary formation and grain refinement: (1) inter-variant boundaries emerging from the encounter of pairs of austenite grains formed from a common ferrite orientation with Kurdjumov–Sachs orientation relationship; (2) icosahedral short-range-ordering-induced (ISRO) nucleation of twin-related γ grains directly from the solidifying liquid. These findings define new routes to achieve grain boundary engineering in a single step in FeCrNi alloys, by tailoring the solidification pathway during the AM process, enabling the design of functionally graded materials with site-specific properties.