We trace the evolution of central galaxies in three \sim { } 10 ^ { 13 } M _ { \odot } galaxy groups simulated at high resolution in cosmological hydrodynamical simulations . In all three cases , the evolution in the group potential leads , at z = 0 , to central galaxies that are massive , gas-poor early-type systems supported by stellar velocity dispersion and which resemble either elliptical or S0 galaxies . Their z \sim { } 2 - 2.5 main progenitors are massive ( M _ { * } \sim { } 3 - 10 \times { } 10 ^ { 10 } M _ { \odot } ) , star forming ( 20 - 60 M _ { \odot } /yr ) galaxies which host substantial reservoirs of cold gas ( \sim { } 5 \times { } 10 ^ { 9 } M _ { \odot } ) in extended gas disks . Our simulations thus show that star forming galaxies observed at z \sim { } 2 are likely the main progenitors of central galaxies in galaxy groups at z = 0 . At z \sim { } 2 the stellar component of all galaxies is compact , with a half-mass radius < 1 kpc . The central stellar density stays approximatively constant from such early epochs down to z = 0 . Instead , the galaxies grow inside-out , by acquiring a stellar envelope outside the innermost \sim { } 2 kpc . Consequently the density within the effective radius decreases by up to two orders of magnitude . Both major and minor mergers contribute to most ( 70 ^ { +20 } _ { -15 } \% ) of the mass accreted outside the effective radius and thus drive an episodical evolution of the half-mass radii , particularly below z = 1 . In situ star formation and secular evolution processes contribute to 14 ^ { +18 } _ { -9 } \% and 16 ^ { +6 } _ { -11 } \% , respectively . Overall , the simulated galaxies grow by a factor \sim { } 4 - 5 in mass and size since redshift z \sim { } 2 . The short cooling time in the center of groups can foster a “ hot accretion ” mode . In one of the three simulated groups this leads to a dramatic rejuvenation of the central group galaxy at z < 1 , affecting its morphology , kinematics and colors . This episode is eventually terminated by a group-group merger . Mergers also appear to be responsible for the suppression of cooling flows in the other two groups . Passive stellar evolution and minor galaxy mergers gradually restore the early-type character of the central galaxy in the cooling flow group on a timescale of \sim { } 1 - 2 Gyr . Although the average properties of central galaxies may be set by their halo masses , our simulations demonstrate that the interplay between halo mass assembly , galaxy merging and gas accretion has a substantial influence on the star formation histories and z = 0 morphologies of central galaxies in galaxy groups .