Let $f$ is Lebesgue integrable function on $[0,1]$ with $\lim_{x\rightarrow 1}f(x) = c$, where $c$ is a constant. Then what would be the value of $n\int x^n f(x) \,dx?$
I think that this value should equal $0$ since $g_n = n x^n f(x) \rightarrow 0$, and $|g_n|\le f$. Hence, by dominated convergence theorem I must have $\int nx^n f(x)\,dx \rightarrow 0$ However, solution states that $\int nx^n f(x)\,dx = c$. I am not sure why dominated convergence theorem doe not hold.
This is one type of behavior that shows us why we need a dominating function (or some condition, anyway) in order to be guaranteed that we can pass the limit inside: the contribution to the integral gets "pushed to the boundary" in the limit.
Here at every point in $x\in [0,1)$ we have $g_n\to 0$, and yet $g_n(1)$ diverges. The overall behavior is that the integral remains finite, just all the area gets squeezed onto a spike at the boundary as $n\to =\infty.$ (As Chappers noted in the comments, the fact that $g_n(1)$ diverges means you're mistaken about $f$ being a dominating function.)
A simple case to consider is when $f(x) = c$ so that $g_n(x) = cn x^n.$ In this case we have $\int_0^1cnx^ndx = c\frac{n}{n+1} \to c.$ And from the fact that the $nx^n$ factor essentially becomes a spike at the $x=1$ boundary, it shouldn't be too hard to see why the answer is $\lim_{x\to 1^{-}}f(x)$ more generally.