Cosmic rays are a type of radiation that comes from space. Cosmic rays aren't really "rays"; they are subatomic particles (mostly protons) with very high energies. Cosmic rays come from various places, including the Sun, supernova explosions, and extremely distant sources such as radio galaxies and quasars. Because of their high energy, this type of particle radiation can be dangerous to people and to equipment, though here on Earth we are mostly shielded from them by our planet's magnetic field and atmosphere.
Cosmic rays were discovered by the Austrian-American physicist Victor Hess in 1912. Hess won the 1936 Nobel Prize in Physics for this discovery. The American physicist Robert Andrews Millikan confirmed Hess discovery in 1925, and coined the term "cosmic rays" for this new type of radiation from space.
There are several different types of cosmic rays, and the radiation comes from various sources. Closest to home are solar cosmic rays, produced on the Sun by solar flares and similar energetic events. Solar cosmic rays have lower energies (up to about 1010 electron volts per particle) than do other types of cosmic rays. Galactic cosmic rays have higher energies (roughly 1010 to 1015 eV) and are believed to come from supernova explosions, black holes, and neutron stars within our own Milky Way galaxy. Even more energetic (1015 eV or higher) are the rare extragalactic cosmic rays. Astronomers believe these particles come from beyond our galaxy, but are otherwise unsure of their exact origins. They may come from the nuclei of active galaxies, from quasars, or be produced during collisions between galaxies. They might even be left over from exotic particle decay processes that occurred when the Universe was young. A fourth, and also somewhat mysterious, type of cosmic ray is called the anomalous cosmic rays (ACR). ACRs have unexpectedly low energy levels, and may be produced at the edge of the heliosphere, the boundary between the region where the Sun's magnetic field is dominant and interstellar space.
What kinds of particles make up cosmic rays? Most, about 90%, are protons; in other words, the ionized nuclei of normal hydrogen, the most abundant form of matter in the Universe. Helium nuclei (also known as alpha particles), which include 2 protons and 2 neutrons, account for about 9% of cosmic rays. Most of the remaining 1% are electrons. The nuclei of a broad range of other types of atoms (including carbon, oxygen, iron, calcium, lithium, beryllium, boron, gallium and others) are represented in small but measurable amounts in the cosmic ray menagerie. Different types of cosmic rays (solar vs. galactic, for instance) have slightly different abundances of different constituents.
Because of their high energies, cosmic rays can be dangerous to living creatures and to machines (especially those that rely on electronics) alike. Fortunately for us, Earth protects us from most cosmic rays. Because they are electrically charged, cosmic rays interact with Earth's magnetic field. Earth's magnetism deflects away many cosmic rays, and steers much of the remainder towards our planet's sparsely populated polar regions. Most particles that make it past Earth's magnetic shields collide with gases in our atmosphere. This is both good and bad for those of us on the planet's surface. When cosmic rays collide with atmospheric gases, the collisions generate new and different particles. In general, these collisions dilute the energy of the particles, producing larger numbers of less energetic particles. A single high-energy cosmic ray can produce a shower of thousands or millions of secondary particles, as secondary particles produced by collisions crash into other gas atoms and molecules, producing yet more particles, and so on. Though this particle shower or cascade (technically known as "spallation") generally produces lower energy, and thus less lethal, particles, some of the secondary byproducts are actually more harmful to living creatures.
How dangerous is cosmic ray radiation? Typically, normal Earthlings are exposed to roughly 2.3 millisieverts (a measure of radiation dosage, abbreviated mSv) of radiation per year. About 0.2 mSv of this dose, or about 9%, is due to cosmic rays. In other words, if you stay on Earth, you normally have little to fear from cosmic rays. However, if you decide to travel into space, and especially if you venture beyond the protective bubble of Earth's magnetosphere, cosmic rays could become a major problem. Scientists estimate that unshielded humans in interplanetary space might receive 400 to 900 mSv of radiation per year, mostly from cosmic rays. Astronauts on a 30 month long Mars mission could be exposed to 1,000 mSv or more of radiation. This is comparable to the recommended career limit of 1 to 4 Sieverts (1,000 to 4,000 mSv) of radiation exposure for astronauts in low Earth orbit. Because cosmic rays have such high energies, they can penetrate deeply into tissue and cause extensive damage to cellular DNA, producing cancers and similar maladies.
The number of cosmic ray particles reaching Earth varies over time. Solar activity varies dramatically over the course of an 11-year cycle. Oddly, the danger from cosmic rays is least when the Sun is most active and producing solar flares and other dramatic "space weather storms". The Sun's activity causes the heliosphere, the vast region in space dominated by the Sun's magnetic field, further outward. The heliosphere acts as another layer of magnetic shielding from galactic and extragalactic cosmic rays; so when the Sun is active this shield expands and fewer external cosmic rays reach Earth. When the Sun is active, we are exposed to larger doses of solar cosmic rays; however, we receive lesser doses of the higher energy, and thus more dangerous, galactic and extragalactic cosmic rays. The net effect is less total danger from radiation exposure. For this reason, when Earthlings do eventually venture beyond our planet on missions to Mars and other interplanetary voyages, they will probably do so when the Sun is at its most active phase!
Cosmic rays help produce some interesting natural phenomena as they zip through our atmosphere. Some cosmic ray collisions with nitrogen (the most abundant gas in Earth's atmosphere) transform the nitrogen atoms into atoms of carbon-14 (or 14C for short). This radioactive isotope of carbon is absorbed by living creatures, and is the basis for carbon-14 dating; you've probably heard of archeological artifacts and similar ancient remains being dated using the carbon-14 method. Cosmic rays in the atmosphere may also help to trigger lightning; the ionized trails the particles leave behind in the air as they pass through may be what's needed to allow atmospheric voltage differences to set off lightning strikes. Finally, cosmic rays might play a role in cloud formation; the radiation may help produce some cloud condensation nuclei, the tiny particles that act as "seeds" that start water droplet formation in clouds. These last two effects (triggering lightning and helping to seed clouds) are somewhat speculative; scientists are still studying both phenomena.