We present a new comprehensive model of the physics of galaxy formation designed for large-scale hydrodynamical simulations of structure formation using the moving mesh code AREPO. Our model includes primordial and metal line cooling with self-shielding corrections, stellar evolution and feedback processes, gas recycling, chemical enrichment, a novel subgrid model for the metal loading of outflows, black hole (BH) seeding, BH growth and merging procedures, quasar- and radio-mode feedback, and a prescription for radiative electro-magnetic (EM) feedback from active galactic nuclei (AGN). The metal mass loading of outflows can be adjusted independently of the wind mass loading. This is required to simultaneously reproduce the stellar mass content of low mass haloes and their gas oxygen abundances. Radiative EM AGN feedback is implemented assuming an average spectral energy distribution and a luminosity-dependent scaling of obscuration effects. This form of feedback suppresses star formation more efficiently than continuous thermal quasar-mode feedback alone, but is less efficient than mechanical radio-mode feedback in regulating star formation in massive haloes. We contrast simulation predictions for different variants of our galaxy formation model with key observations. Our best match model reproduces, among other things, the cosmic star formation history, the stellar mass function, the stellar mass - halo mass relation, g-, r-, i-, z-band SDSS galaxy luminosity functions, and the Tully-Fisher relation. We can achieve this success only if we invoke very strong forms of stellar and AGN feedback such that star formation is adequately reduced in both low and high mass systems. In particular, the strength of radio-mode feedback needs to be increased significantly compared to previous studies to suppress efficient cooling in massive, metal-enriched haloes.