We use cosmological hydrodynamical simulations to investigate the role of feedback from accreting black holes on the evolution of sizes , compactness , stellar core density and specific star-formation of massive galaxies with stellar masses of M _ { \ast } > 10 ^ { 10.9 } \hbox { $ \thinspace M _ { \odot } $ } . We perform two sets of cosmological zoom-in simulations of 30 halos to z = 0 : ( 1 ) without black holes and Active Galactic Nucleus ( AGN ) feedback and ( 2 ) with AGN feedback arising from winds and X-ray radiation . We find that AGN feedback can alter the stellar density distribution , reduce the core density within the central 1 kpc by 0.3 dex from z = 1 , and enhance the size growth of massive galaxies . We also find that galaxies simulated with AGN feedback evolve along similar tracks to those characterized by observations in specific star formation versus compactness . We confirm that AGN feedback plays an important role in transforming galaxies from blue compact galaxies into red extended galaxies in two ways : ( 1 ) it effectively quenches the star formation , transforming blue compact galaxies into compact quiescent galaxies and ( 2 ) it also removes and prevents new accretion of cold gas , shutting down in-situ star formation and causing subsequent mergers to be gas-poor or mixed . Gas poor minor mergers then build up an extended stellar envelope . AGN feedback also puffs up the central region through the fast AGN driven winds as well as the slow expulsion of gas while the black hole is quiescent . Without AGN feedback , large amounts of gas accumulate in the central region , triggering star formation and leading to overly massive blue galaxies with dense stellar cores .