Abstract
A large-scale hydrodynamical cosmological simulation, Horizon-AGN, is used to investigate the alignment between the spin of galaxies and the cosmic filaments above redshift 1.2. The analysis of more than 150 000 galaxies per time step in the redshift range 1.2 < z < 1.8 with morphological diversity shows that the spin of low-mass blue galaxies is preferentially aligned with their neighbouring filaments, while high-mass red galaxies tend to have a perpendicular spin. The reorientation of the spin of massive galaxies is provided by galaxy mergers, which are significant in their mass build-up. We find that the stellar mass transition from alignment to misalignment happens around 3 × 1010 M⊙. Galaxies form in the vorticity-rich neighbourhood of filaments, and migrate towards the nodes of the cosmic web as they convert their orbital angular momentum into spin. The signature of this process can be traced to the properties of galaxies, as measured relative to the cosmic web. We argue that a strong source of feedback such as active galactic nuclei is mandatory to quench in situ star formation in massive galaxies and promote various morphologies. It allows mergers to play their key role by reducing post-merger gas inflows and, therefore, keeping spins misaligned with cosmic filaments.