$$\int{3e^{3x}}dx$$
Setting $u=e^x$ gives $$\frac{3}{e^x}\int{u^3}du,$$ which gives $\frac{3e^4}{4}+C$, which is evidently incorrect.
However, when I set $u=3x$, I get $$\int{e^u}du,$$ which evaluates to $e^{3x}+C,$ which is correct.
Why am I unable to solve the integral when $u=e^x$? Is it because the derivative of the inside function has to be constant?
When making a $u$-substitution, it is important to express all of the terms involving the letter $x$ in terms of $u$ instead.
So, if in your example, we let $u=e^x$, we get that $du=e^x \, dx$ and $u^2=e^{2x}$. Thus $$ \int 3e^{3x} \, dx=\int 3e^{2x}\cdot e^x\, dx=\int 3u^2 \, du=u^3+C=e^{3x}+C \, . $$ Your solution had two mistakes in it: you did not express all of the terms involving $x$ in terms of $u$ instead, and you brought the term $3/e^{3x}=3/u$ to the outside of the integral, even though it is not a constant.
It is fine to make a substitution of the form $u=g(x)$ even when $g'(x)$ is not a constant, provided that you adhere to the rules above.