A recent determination of the relationships between the X-ray luminosity of the ISM (Lx) and the stellar and total mass, for a sample of nearby early-type galaxies (ETGs), is used to investigate the origin of the hot gas, via a comparison with the results of hydrodynamical simulations of the ISM evolution for a large set of isolated ETGs. After the epoch of major galaxy formation (after z~2), the ISM is replenished by stellar mass losses and SN ejecta, at the rate predicted by stellar evolution, and is depleted by star formation; it is heated by the thermalization of stellar motions, SNe explosions and the mechanical (from winds) and radiative AGN feedback. The models agree well with the observed relations, even for the largely different Lx values at the same mass, thanks to the sensitivity of the gas flow to many galaxy properties; this holds for models including AGN feedback, and those without. Therefore, the mass input from the stellar population is able to account for a major part of the observed Lx; and AGN feedback, while very important to maintain massive ETGs in a time-averaged quasi-steady state, keeping low star formation and the black hole mass, does not dramatically alter the gas content originating in stellar recycled material. These conclusions are based on theoretical predictions for the stellar population contributions in mass and energy, and on a self-consistent modeling of AGN feedback.