Cosmic rays consist of highly-charged atomic nuclei (and sometimes other atomic particles) that travel at speeds close to the speed of light. The term refers both to galactic cosmic rays as well as rays that originate from solar activity. They can damage DNA and increase the risk of cancer as well as mental disorders. Despite their name, they are in fact not akin to magnetic rays.
The atmosphere of a planet generally shields the inhabitants from being harmed by cosmic rays, but those in space are not protected, so starships must retreat to a safe distance until the storm subsides. (TOS: "The Empath")