During my thesis, I studied simulations of star-forming galaxies at the apogee of cosmic star formation and quasar activity (z ~ 2) to examine how they form stars and produce outflows, in relation to stellar and AGN feedback. The purpose of this thesis is to give clues to answer two key questions that still remain today in the field of galaxy evolution: why do some galaxies suddenly stop forming stars? Why do models predict galaxies too massive compared to observations? Indeed, even though the baryonic mass budget in today's Universe is well-known, models accounting for it create galaxies which are too massive and produce too many stars compared to observations. Efficient expelling mechanisms such as galactic outflows generated by stars and AGNs are thus needed to reduce the discrepancy between observations and models. Nonetheless, while the mass outflow rate of such stellar outflows may be consistent with the huge fraction of baryons missing from galaxies, their velocities are often too small to escape the dark matter halo, and vice-versa for AGN outflows. The coupling of AGN and stellar winds is however a good candidate to create powerful winds with velocities above the escape velocity of the dark matter halo, together with mass outflow rates of a few times the star formation rate of the galaxy, in potential agreement with the amount of missing baryons.