I show cosmic chemical enrichment in our cosmological, hydrodynamical simulations that includes star formation and feedback from stars, supernovae, and active galactic nuclei (AGN). The nucleosynthesis yields and supernova models are consistent with the observed elemental abundances in the Milky Way. Our cosmological simulations are in good agreement with many observations of galaxies, including cosmic star formation rates, blackhole mass-galaxy mass relation, size-mass relation, mass-metallicity relations (MZRs) of galaxies, and the \alpha enhancement of early-type galaxies. In our model, super-massive blackholes originate the first stars with only ~100-1000 Msun, contrary to the merger products in other models. Our AGN cause large-scale metal outflows, which result in the MZR and the enrichment of intergalactic medium, as well as the quenching of star formation in massive galaxies. The MZR evolve with a steeper slop at higher redshifts. Gas-phase metallicity radial gradients are flatten by the AGN winds, while stellar metallicity gradients trace the merging histories, correlating with the environment. These predictions can be tested with IFU surveys such as MaNGA. Feedback is supposed to be the most important in galaxy modelling, and we found that the metal outflow is essential.