X-rays are basically the same thing as visible light rays. Both are wavelike forms of electromagnetic energy carried by particles called photons (see How Light Works for details). The difference between X-rays and visible light rays is the energy level of the individual photons. This is also expressed as the wavelength of the rays.
Visible light photons and X-ray photons are both produced by the movement of electrons in atoms. Electrons occupy different energy levels, or orbitals, around an atom's nucleus. When an electron drops to a lower orbital, it needs to release some energy -- it releases the extra energy in the form of a photon. The energy level of the photon depends on how far the electron dropped between orbitals. (See this page for a detailed description of this process.)
When a photon collides with another atom, the atom may absorb the photon's energy by boosting an electron to a higher level. For this to happen, the energy level of the photon has to match the energy difference between the two electron positions. If not, the photon can't shift electrons between orbitals.
The atoms that make up your body tissue absorb visible light photons very well. The energy level of the photon fits with various energy differences between electron positions. Radio waves don't have enough energy to move electrons between orbitals in larger atoms, so they pass through most stuff. X-ray photons also pass through most things, but for the opposite reason: They have too much energy.
Other X-Ray Uses
The most important contributions of X-ray technology have been in the world of medicine, but X-rays have played a crucial role in a number of other areas as well. X-rays have been pivotal in research involving quantum mechanics theory, crystallography and cosmology. In the industrial world, X-ray scanners are often used to detect minute flaws in heavy metal equipment. And X-ray scanners have become standard equipment in airport security, of course.
They can, however, knock an electron away from an atom altogether. Some of the energy from the X-ray photon works to separate the electron from the atom, and the rest sends the electron flying through space. A larger atom is more likely to absorb an X-ray photon in this way, because larger atoms have greater energy differences between orbitals -- the energy level more closely matches the energy of the photon. Smaller atoms, where the electron orbitals are separated by relatively low jumps in energy, are less likely to absorb X-ray photons.
The soft tissue in your body is composed of smaller atoms, and so does not absorb X-ray photons particularly well. The calcium atoms that make up your bones are much larger, so they are better at absorbing X-ray photons.
In the next section, we'll see how X-ray machines put this effect to work.