carbon-14 is produced in the atmosphere primarily by what?

It is produced by cosmic ray bombardment of N-14 atoms by slow neutrons that are liberated in reactions of cosmic ray particles with upper atmosphere molecules.

The radioactive carbon-14 is made from nitrogen. The bombarding cosmic rays are mostly protons, and the most energetic ones come from outer space.