Comparing galaxy formation in the L-GALAXIES semi-analytical model and the IllustrisTNG simulations