The observed massive end of the galaxy stellar mass function is steeper than its predicted dark matter halo counterpart in the standard $Lambda $CDM paradigm. In this paper, we investigate the impact of active galactic nuclei (AGN) feedback on star formation in massive galaxies. We isolate the impact of AGNs by comparing two simulations from the HORIZON suite, which are identical except that one also includes super massive black holes (SMBH), and related feedback models. This allows us to cross-identify individual galaxies between simulations and quantify the effect of AGN feedback on their properties, including stellar mass and gas outflows. We find that massive galaxies ($ rm M_{*} geq 10^{11} M_odot $) are quenched by AGN feedback to the extent that their stellar masses decrease by up to 80% at $z=0$. SMBHs affect their host halo through a combination of outflows that reduce their baryonic mass, particularly for galaxies in the mass range $ rm 10^9 M_odot leq M_{*} leq 10^{11} M_odot $, and a disruption of central gas inflows, which limits in-situ star formation. As a result, net gas inflows onto massive galaxies, $ rm M_{*} geq 10^{11} M_odot $, drop by up to 70%. We measure a redshift evolution in the stellar mass ratio of twin galaxies with and without AGN feedback, with galaxies of a given stellar mass showing stronger signs of quenching earlier on. This evolution is driven by a progressive flattening of the $rm M_{rm SMBH}-M_* $ relation with redshift, particularly for galaxies with $rm M_{*} leq 10^{10} M_odot $. $rm M_{rm SMBH}/M_*$ ratios decrease over time, as falling average gas densities in galaxies curb SMBH growth.