X-rays are a form of electromagnetic radiation, just like visible light. In a health care setting, a machines sends are individual x-ray particles, called photons.
These particles pass through the body. A computer or special film is used to record the images that are created. Structures that are dense (such as bone) will block most of the x-ray particles, and will appear white. Metal and contrast media (special dye used to highlight areas of the body) will also appear white.
Structures containing air will be black and muscle, fat, and fluid will appear as shades of gray.