We perform a comparison, object-by-object and statistically, between the Munich semi-analytical model, L-Galaxies, and the IllustrisTNG hydrodynamical simulations. By running L-Galaxies on the IllustrisTNG dark matter-only merger trees, we identify the same galaxies in the two models. This allows us to compare the stellar mass, star formation rate and gas content of galaxies, as well as the baryonic content of subhaloes and haloes in the two models. We find that both the stellar mass functions and the stellar masses of individual galaxies agree to better than $\sim0.2\,$dex. On the other hand, specific star formation rates and gas contents can differ more substantially. At $z=0$ the transition between low-mass star-forming galaxies and high-mass, quenched galaxies occurs at a stellar mass scale $\sim0.5\,$dex lower in IllustrisTNG than in L-Galaxies. IllustrisTNG also produces substantially more quenched galaxies at higher redshifts. Both models predict a halo baryon fraction close to the cosmic value for clusters, but IllustrisTNG predicts lower baryon fractions in group environments. These differences are due primarily to differences in modelling feedback from stars and supermassive black holes. The gas content and star formation rates of galaxies in and around clusters and groups differ substantially, with IllustrisTNG satellites less star-forming and less gas-rich. We show that environmental processes such as ram-pressure stripping are stronger and operate to larger distances and for a broader host mass range in IllustrisTNG. We suggest that the treatment of galaxy evolution in the semi-analytic model needs to be improved by prescriptions which capture local environmental effects more accurately.