Over a century ago in 1895, Roentgen discovered the first example of ionizing radiation, x-rays. The key to Roentgens discovery was a device called a Crooke’s tube, which was a glass envelope under high vacuum, with a wire element at one end forming the cathode, and a heavy copper target at the other end forming the anode. When a high voltage was applied to the electrodes, electrons formed at the cathode would be pulled towards the anode and strike the copper with very high energy. Roentgen discovered that very penetrating radiations were produced from the anode, which he called x-rays.

X-ray production whenever electrons of high energy strike a heavy metal target, like tungsten or copper. When electrons hit this material, some of the electrons will approach the nucleus of the metal atoms where they are deflected because of there opposite charges (electrons are negative and the nucleus is positive, so the electrons are attracted to the nucleus). This deflection causes the energy of the electron to decrease, and this decrease in energy then results in forming an x-ray.

Medical x-ray machines in hospitals use the same principle as the Crooke’s Tube to produce x-rays. The most common x-ray machines use tungsten as there cathode, and have very precise electronics so the amount and energy of the x-ray produced is optimum for making images of bones and tissues in the body.

Here is a good page that shows how x-rays are formed