  We quantify the correlations between gas-phase and stellar metallicities and
global properties of galaxies, such as stellar mass, halo mass, age and gas
fraction, in the Evolution and Assembly of GaLaxies and their Environments
(EAGLE) suite of cosmological hydrodynamical simulations. The slope of the
correlation between stellar mass and metallicity of star-forming (SF) gas
($M_*-Z_{\rm SF,gas}$ relation) depends somewhat on resolution, with the
higher-resolution run reproducing a steeper slope. This simulation predicts a
non-zero metallicity evolution, increasing by $\approx 0.5$ dex at $\sim 10^9
{\rm M}_{\odot}$ since $z = 3$. The simulated relation between stellar mass,
metallicity and star formation rate at $z \lesssim 5$ agrees remarkably well
with the observed fundamental metallicity relation. At $M_* \lesssim 10^{10.3}
{\rm M}_{\odot}$ and fixed stellar mass, higher metallicities are associated
with lower specific star formation rates, lower gas fractions and older stellar
populations. On the other hand, at higher $M_*$, there is a hint of an
inversion of the dependence of metallicity on these parameters. The fundamental
parameter that best correlates with the metal content, in the simulations, is
the gas fraction. The simulated gas fraction-metallicity relation exhibits
small scatter and does not evolve significantly since $z = 3$. In order to
better understand the origin of these correlations, we analyse a set of lower
resolution simulations in which feedback parameters are varied. We find that
the slope of the simulated $M_*-Z_{\rm SF,gas}$ relation is mostly determined
by stellar feedback at low stellar masses ($M_* \lesssim 10^{10} {\rm
M}_{\odot}$), and at high masses ($M_* \gtrsim 10^{10} {\rm M}_{\odot}$) by the
feedback from active galactic nuclei.
