X-rays are a form of electromagnetic radiation, just like visible light. In a health care setting, X-rays are emitted by a machine as individual "particles" (photons) that pass through the body and then get detected by a sensitive film.
Structures that are dense (such as bone) will block most of the photons, and will appear white on developed film. Structures containing air will be black on film, and muscle, fat, and fluid will appear as shades of gray. Metal and contrast media (intravenous or oral contrast) blocks almost all the photons and will appear bright white.
The basic science of X-ray generation and detection is the key behind general radiographs of the body, mammography, fluoroscopy (real-time imaging on video screens), and computed tomography (CT).