Comets are cold and icy objects that go around our Sun, usually with very little energy to do much of anything. So I was very surprised to hear that the gamma-ray space observatory Swift detected X-rays from comets. X-rays can only emitted in high-energy processes, so how could something as unenergetic as a comet produce them? It was even more surprising to me when I learned that X-rays from comets were already discovered in 1996 by ROSAT.
It turns out that it's not the comets themselves that are the source of the energy. It's actually the Sun that's the source of all the energy, just like for almost everything else in the Solar System. The Sun emits a solar wind made out of very high-energy particles, and when such a particle hits a comet, it can strip an electron from an atom that is part of the comet. A high-energy photon, i.e. an X-ray, can be emitted in this process.
This happens to be the same process that generates energetic neutral atoms at the boundaries of the heliosphere, which are what IBEX observes to learn about the boundary between the Solar System and interstellar space.