X-rays were a type of radiation. They were used in medical imaging. They were also produced naturally by a variety of stellar phenomena.
History and specifics
In 2265, the USS Enterprise attempted to save Mestiko from the X-ray radiation emitted by a rogue pulsar, but were only partially successful. (TOS - Mere Anarchy eBook: Things Fall Apart)
In 2266, the Enterprise used an X-ray radar to scan the Ferrous-Asteroid Belt for Bandit asteroid ships. (TOS comic: "The Trial of Captain Kirk")
In 2269, when a mirror image duplicate of Spock was created, James T. Kirk asked Leonard McCoy if X-rays could be used to tell the two apart, but since Vulcans had perfect bilateral symmetry, this was impossible. (TOS novel: Spock Must Die!)
In 2270, the Enterprise encountered X-ray storms while in orbit of a naked singularity. (TOS novel: The Entropy Effect)
In 2348, the USS Stargazer disabled several ships belonging to Acamarian Gatherers by luring them towards a red dwarf just before it gave off an x-ray flare. (TNG novel: The Buried Age)
In 2365, the USS Enterprise-D, out of desperation, used X-rays in an attempt to scan a Cognoscente weapon, to no avail. (TNG novel: Strike Zone)