By means of zoom-in hydrodynamic simulations we quantify the amount of neutral hydrogen (HI) hosted by groups and clusters of galaxies. Our simulations, which are based on an improved formulation of smoothed particle hydrodynamics (SPH), include radiative cooling, star formation, metal enrichment and supernova feedback, and can be split in two different groups, depending on whether feedback from active galactic nuclei (AGN) is turned on or off. Simulations are analyzed to account for HI self-shielding and the presence of molecular hydrogen. We find that the mass in neutral hydrogen of dark matter halos monotonically increases with the halo mass and can be well described by a power-law of the form $M_{rm HI}(M,z)propto M^{3/4}$. Our results point out that AGN feedback reduces both the total halo mass and its HI mass, although it is more efficient in removing HI. We conclude that AGN feedback reduces the neutral hydrogen mass of a given halo by $sim50%$, with a weak dependence on halo mass and redshift. The spatial distribution of neutral hydrogen within halos is also affected by AGN feedback, whose effect is to decrease the fraction of HI that resides in the halo inner regions. By extrapolating our results to halos not resolved in our simulations we derive astrophysical implications from the measurements of $Omega_{rm HI}(z)$: halos with circular velocities larger than $sim25~{rm km/s}$ are needed to host HI in order to reproduce observations. We find that only the model with AGN feedback is capable of reproducing the value of $Omega_{rm HI}b_{rm HI}$ derived from available 21cm intensity mapping observations.