We performed N–body + hydrodynamical simulations of the formation and evolution of galaxy groups and clusters in a \Lambda CDM cosmology . The simulations invoke star formation , chemical evolution with non-instantaneous recycling , metal dependent radiative cooling , strong starbursts and ( optionally ) AGN driven galactic super winds , effects of a meta-galactic UV field and thermal conduction . The properties of the galaxy populations in two clusters , one Virgo-like ( T \sim 3 keV ) and one ( sub ) Coma-like ( T \sim 6 keV ) , are discussed . The global star formation rates of the cluster galaxies are found to decrease very significantly from redshift z =2 to 0 , in agreement with observations . The total K-band luminosity of the cluster galaxies correlates tightly with total cluster mass , and for models without additional AGN feedback , the zero point of the relation matches the observed one fairly well . Compared to the observed galaxy luminosity function , the simulations nicely match the number of intermediate–mass galaxies ( –20 \la M _ { B } \la –17 , smaller galaxies being affected by resolution limits ) but they show a deficiency of bright galaxies in favour of an overgrown central cD . High resolution tests indicate that this deficiency is not simply due to numerical “ over–merging ” . The redshift evolution of the luminosity functions from z =1 to 0 is mainly driven by luminosity evolution , but also by merging of bright galaxies with the cD . The colour–magnitude relation of the cluster galaxies matches the observed “ red sequence ” , though with a large scatter , and on average galaxy metallicity increases with luminosity . As the brighter galaxies are essentially coeval , the colour–magnitude relation results from metallicity rather than age effects , as observed . On the whole , a top-heavy IMF appears to be preferably required to reproduce also the observed colours and metallicities of the stellar populations .