Who invented x-rays? When were they discovered?
More accurately you should say, "who discovered X-Rays" or "Who invented the X-Ray machine." In 1895 Röntgen discovered mysterious rays coming from a Cathode Ray Tube that were not deflected by magnets and could penetrate most objects. Since he didn't know what they were he called them X-Rays but the name stuck. He also can be said to have invented the X-Ray machine although no doubt other apparatus generated X-Rays unnoticed. Luckily for Doctors calcium in bones absorbes more X-Rays than fat and muscle so these rays can be used to take pictures of bones.
X-Rays and Gamma rays are the two most dangerous kinds of electromagnetic radiation because they are ionizing radation meaning they are energenic enough to knock electrons from their orbits. These rays also can break DNA and cause genetic damage and mutation. Many of the pioneers of X-Rays were disfigured or killed by their exposure. After his lab assistant died from X-Ray exposure Thomas Edison stopped research on them and even refused a medical X-Ray after breaking a bone.
Luckily modern X-Ray imaging requires only a tiny fraction of the amount of radation the early fluoroscopes used.
Conrad Roentgen (1845–1923), a German physicst, discovered X rays in 1895 when he was experimenting with electricity. But, since he didn't know what the rays mean, he called them X-rays, as X is a mathematical constant that does not need to be defined, an unknown variable. He was awarded a Nobel Prize for his achievement.