High-energy cosmic rays from outer space collide with atoms in the upper atmosphere, producing secondary particles, including fast neutrons. These neutrons collide with nitrogen nuclei (¹⁴N), causing a nuclear reaction (¹⁴N + n → ¹⁴C + p) where a nitrogen nucleus absorbs a neutron and emits a proton, transforming into a Carbon-14 atom.