$u$-Subtitution with a definite integral that has a constant gives different answer I have the following integral:
$$\int_0^\pi (2+\cos^2(t)\sin(t))\,\mathrm dt$$
Choosing $u = \cos(t)$, I would get the following result:
$$2u - \frac{u^3}{3}$$
which is:
$$2\cos(t) - \frac{\cos^3(t)}{3}\Bigg|_0^\pi.$$ However, if I solve the same integral by taking the constant out as its own integral:
$$2\int_0^\pi\,\mathrm dt+\int_0^\pi\cos^2(t)\sin(t)\,\mathrm dt$$
And the computed antiderivative would be 
$$2\pi-\frac{\cos^3(t)}{3}$$
Why this discrepancy? Which one is the right one?

The latter is correct. You really only needed u-substitution for the trig part of that integral. You've incorrectly applied the substitution for $\mathrm dt$ when you used the substitution for the integral of the constant.
$$\begin{align}
\int_{0}^{\pi}2\,\mathrm dt = -\int_{u(0)}^{u(\pi)}\frac{2}{\sin(t)}\,\mathrm du &= -\int_{u(0)}^{u(\pi)}\frac{2}{\sqrt{1-\cos(t)^2}}\,\mathrm du\\ &= -\int_{1}^{-1}\frac{2}{\sqrt{1-u^2}}\,\mathrm du = \int_{-1}^{1}\frac{2}{\sqrt{1-u^2}}\,\mathrm du\\ 
&= 2\pi
\end{align}$$
