We study the origin of unresolved X-ray emission from the bulge of M31 based on archival Chandra and XMM-Newton observations. We demonstrate that three different components are present. (i) Broad-band emission from a large number of faint sources - mainly accreting white dwarfs and active binaries, associated with the old stellar population, similar to the Galactic ridge X-ray emission of the Milky Way. The X-ray to K-band luminosity ratios are compatible with those for the Milky Way and for M32; in the 2-10 keV band, the ratio is (3.6 ± 0.2) x 10 27 erg s -1 L -1 ⊙ . (ii) Soft emission from ionized gas with a temperature of about ∼300 eV and a mass of ∼2 x 10 6 M ⊙ . The gas distribution is significantly extended along the minor axis of the galaxy, suggesting that it may be outflowing in the direction perpendicular to the galactic disc. The mass and energy supply from evolved stars and Type Ia supemovae is sufficient to sustain the outflow. We also detect a shadow cast on the gas emission by spiral arms and the 10-kpc star-forming ring, confirming significant extent of the gas in the 'vertical' direction. (iii) Hard extended emission from spiral arms, most likely associated with young stellar objects and young stars located in the star-forming regions. The L x /SFR (star formation rate) ratio equals ∼9 x 10 38 (erg s -1 )(Mz yr -1 ) -1 , which is about ∼1/3 of the high-mass X-ray binary contribution, determined earlier from Chandra observations of other nearby galaxies.