The observed X-ray background is thought to result from, at the "soft" end (below 0.3 keV), galactic X-ray emission, the "galactic" X-ray background, and, at the "hard" end (above 0.3keV), from a combination of many unresolved X-ray sources outside of the Milky Way, the "cosmic" X-ray background (CXB).
The galactic X-ray background is produced largely by emission from hot gas in the Local Bubble within 100 parsecs of the Sun.
Deep surveys with X-ray telescopes, such as the Chandra X-ray Observatory, have demonstrated that around 80% of the cosmic X-ray background is due to resolved extra-galactic X-ray sources, the bulk of which are unobscured ("type-1") and obscured ("type-2") active galactic nuclei (AGN).