Cosmic rays are not really rays at all, but particles. They are ionised atoms (atoms with missing electrons) ranging from a single proton up to an iron nucleus and beyond, but being typically protons and alpha particles (2 protons and 2 neutrons). They originate from space, being produced by a number of different sources, such as the Sun, other stars, and more exotic objects, such as supernova (exploding stars) and their remnants, neutron stars and black holes, as well distant galaxies. Cosmic ray particles are travelling very close to the speed of light, and are highly energetic.
The Earth's atmosphere protects us from significant exposure to cosmic rays. Without the atmosphere, the Earth's surface would be a deadly environment. Even if we could survive without air, cosmic rays would quickly damage the DNA which makes up our living cells. As a cosmic ray enters the upper atmosphere, it collides with a particle, usually a nitrogen or oxygen molecule, producing a shower of lower energy particles. Many of these lower energy particles are absorbed by the Earth's atmosphere as they travel down to the surface.