Consider a continuous random variable $Y = X^2$ such that $X\sim N(0, 1)$. The PDF of this variable is $f_Y(x)= \dfrac{1}{\sqrt{2\pi}} x^{-\frac12}e^{-\frac{x}{2}}$ as discussed in this post.
According to Wikipedia, the MGF of a random variable X is defined to be $M_X(t) = E[e^{tX}]$. So, naturally, the MGF of Y should be $$M_Y(t) = E[e^{tY}] = E[e^{tX^2}] = \int_{-\infty}^\infty e^{tx^2}f_Y(x)dx = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^\infty e^{tx^2}x^{-\frac12}e^{-\frac{x}{2}}\,dx$$
However, this integral doesn't converge, and pretty much every resource I can find is saying that this integral should just be $\dfrac{1}{\sqrt{2\pi}}\displaystyle \int_{-\infty}^\infty e^{tx^2}e^{-\frac{x^2}{2}}dx$ , which does indeed evaluate to the correct MGF of $M_Y(t) = (1 - 2t)^{-\frac12}$
Why is the PDF of $X$ used for the expected value of $e^{X^2}$ instead of the PDF of $X^2$?
While earning a doctorate in statistics I never knew the name "law of the unconscious statistician", but of course I knew the proposition, and nowadays that appears to be what some call it. $$ \operatorname E(g(X)) = \begin{cases} \displaystyle \int_{-\infty}^\infty g(x)f_X(x)\,dx. & \text{(This one is the “law of the unconscious statistician.'')} \\[10pt] \displaystyle \int_{-\infty}^\infty xf_{g(X)} (x) \,dx. \end{cases} $$ Sometimes direct evalution of the first integral above is simpler than direct evaluation of the second.
Thus $$ \operatorname E(e^{tY}) = \int_{-\infty}^\infty e^{tx} f_Y(x) \, dx = \int_{-\infty}^\infty e^{tx^2} f_X(x)\, dx = \int_{-\infty}^\infty x f_{e^{tX^2}}(x) \, dx. $$