  Using the IllustrisTNG simulations, we investigate the connection between
galaxy morphology and star formation in central galaxies with stellar masses in
the range $10^9-10^{11.5}~\mathrm{M}_{\odot}$. We quantify galaxy morphology by
a kinematical decomposition of the stellar component into a spheroidal and a
disc component (spheroid-to-total ratio, S/T) and by the concentration of the
stellar mass density profile ($C_{82}$). S/T is correlated with stellar mass
and star-formation activity, while $C_{82}$ correlates only with stellar mass.
Overall, we find good agreement with observational estimates for both S/T and
$C_{82}$. Low and high mass galaxies are dominated by random stellar motion,
while only intermediate-mass galaxies
($M_{\star}\approx10^{10}-10^{10.5}~\mathrm{M}_{\odot}$) are dominated by
ordered rotation. Whereas higher-mass galaxies are typical spheroids with high
concentrations, lower-mass galaxies have low concentration, pointing to
different formation channels. Although we find a correlation between S/T and
star-formation activity, in the TNG model galaxies do not necessarily change
their morphology when they transition through the green valley or when they
cease their star formation, this depending on galaxy stellar mass and
morphological estimator. Instead, the morphology (S/T and $C_{82}$) is
generally set during the star-forming phase of galaxies. The apparent
correlation between S/T and star formation arises because earlier-forming
galaxies had, on average, a higher S/T at a given stellar mass. Furthermore, we
show that mergers drive in-situ bulge formation in intermediate-mass galaxies
and are responsible for the recent spheroidal mass assembly in the massive
galaxies with $M_{\star}>10^{11}~\mathrm{M}_{\odot}$. In particular, these
massive galaxies assemble about half of the spheroidal mass while star-forming
and the other half through mergers while quiescent.
