Cosmic rays enter the earth's atmosphere in large numbers every day. For example, every person is hit by about half a million cosmic rays every hour. It is not uncommon for a cosmic ray to collide with an atom in the atmosphere, creating a secondary cosmic ray in the form of an energetic neutron, and for these energetic neutrons to collide with nitrogen atoms. When the neutron collides, a nitrogen-14 (seven protons, seven neutrons) atom turns into a carbon-14 atom (six protons, eight neutrons) and a hydrogen atom (one proton, zero neutrons). Carbon-14 is radioactive, with a half-life of about 5,700 years.
For more information on cosmic rays and half-life, as well as the process of radioactive decay, see How Nuclear Radiation Works.
Carbon-14 in Living Things
The carbon-14 atoms that cosmic rays create combine with oxygen to form carbon dioxide, which plants absorb naturally and incorporate into plant fibers by photosynthesis. Animals and people eat plants and take in carbon-14 as well. The ratio of normal carbon (carbon-12) to carbon-14 in the air and in all living things at any given time is nearly constant. Maybe one in a trillion carbon atoms are carbon-14. The carbon-14 atoms are always decaying, but they are being replaced by new carbon-14 atoms at a constant rate. At this moment, your body has a certain percentage of carbon-14 atoms in it, and all living plants and animals have the same percentage.