X-Rays are not death rays.
Yes, they are (or at least can be) high-energy radiation, but at low levels they can still be detectable without "cooking" anyone or anything. In fact, at this very moment (unless you're sitting your lead-lined radiation shelter), you are being bathed in X-Rays that are the result of the background cosmic radiation interacting with our atmosphere and generating a slew of secondary radiation. It's of course heavier in the upper layers of the atmosphere; so much so, in fact, that it's actually a concern for airline crews and very frequent travelers -- though that's mostly from the other types generated rather than the X-Rays per se.
Back to the point: Why would any creature evolve the ability to detect X-Rays? Putting aside that evolution isn't some intelligent entity that sits on a mountain pondering, "What should I evolve next?", as anyone who has been to the dentist or broken (or suspected they broke) a bone, X-Rays are good at passing through things. So one advantage a creature with "X-Ray vision" would have could be the ability to better see other creatures (or hazards) hiding in foliage, for example; they'd be able to see a skeleton behind that cluster of leaves over there.
Another advantage -- though of more utility to an intelligent creature -- would be to be able to see and diagnose skeletal problems, such as broken bones, without the need for complex machinery. This could allow a herd to more readily identify and care for an injured individual, or a predator to more easily spot the weakling in the herd and go for them. (Consider e.g. a hairline fracture, which you could walk on with not much more than a limp just fine; suddenly have to start running and zig-zagging to avoid a predator, however, and your own evasions could snap the bone the rest of the way, crippling you at the worst possible moment!)
And, of course, it would give any creature that could see them a big bright practically-neon warning sign to stay away from any very high-level sources that could be dangerous to even be in the general vicinity of.
That said, however, the background radiation isn't strong enough to get photographic quality images of bones. Not in our environment, at least. There could still be some of the same benefits, but far from the dramatic representations of Superman's power (which, more often than not, is "see-through vision", not really "X-Ray vision" /soapbox). There are, however, other types of radiation, other particles, that could have similar results for a creature capable of detecting them, yet don't pose a health hazard by simply being present at the necessary levels to be useful.
On the other hand, a creature in an environment where X-Rays per se are present at a high enough level to be truly useful would no doubt have evolved in a way to be resistant to, if not immune to, the negative effects X-Rays have on our biology; they most likely, in fact, have a completely different biology altogether that isn't affected by X-Rays. It's even possible that "X-Ray vision" would be the de facto form of vision, instead of seeing what we describe as the "visible spectrum".
A third possibility is that a creature has evolved the ability to project short bursts of X-Rays somehow, and combined with this sensory organ that can see them can use it as a sort of echolocation. Evolutionarily this would probably evolve as the eyes developing a third addition to the rods and cones that can "see" X-Rays, and then the creature developing a unique form of bioluminescence that emits X-Rays; it would probably require a massive expenditure of energy, so it wouldn't be something like the angler fish that just lets the thing glow all the time, but it would be useful to a predator on the prowl or a herd animal concerned for the health of a herd mate. Honestly, though, without a stronger description of how something biological could generate and project X-Rays, I doubt I'd find this plausible.