  The optical morphology of galaxies is strongly related to galactic environment, with the fraction of early-type galaxies increasing with local galaxy density. In this work we present the first analysis of the galaxy morphology-density relation in a cosmological hydrodynamical simulation. We use a convolutional neural network, trained on observed galaxies, to perform visual morphological classification of galaxies with stellar masses $M_\ast > 10^{10} \, \mathrm{M}_\odot$ in the EAGLE simulation into elliptical, lenticular and late-type (spiral/irregular) classes. We find that EAGLE reproduces both the galaxy morphology-density and morphology-mass relations. Using the simulations, we find three key processes that result in the observed morphology-density relation: (i) transformation of disc-dominated galaxies from late-type (spiral) to lenticular galaxies through gas stripping in high-density environments, (ii) formation of lenticular galaxies by merger-induced black hole feedback in low-density environments, and (iii) an increasing fraction of high-mass galaxies, which are more often elliptical galaxies, at higher galactic densities. 
The galaxy morphology-density relation in the EAGLE simulation