X-rays cannot propagate through the atmosphere and therefore satellites are necessary to detect them. A quick look is enough to see that most X-ray sources are on the galactic plane. This must mean that they are inside our Galaxy. A few selected objects are named. Sources which are not at all associated with our Galaxy are marked in green.
Galactic sources are in red.
One of the first satellites dedicated to the study of X-rays was Uhuru . It produced a map of the strongest X-ray sources in the sky. Most of the sources were observed to be inside our Galaxy, the Milky Way. The only possible mechanism for generating the radiation is the gravitational acceleration of particles in the gravitational field of compact objects. Then the other instruments can be pointed towards the source and analyse the signal.