You could do it in various ways.
One method (ultimately justified by the multi-variable chain rule) is to regard one x as varying, the others constant, and then add the results:
[tex]\frac{dy}{dx}=(3x)^{x^{2}}+3x^{3}(3x)^{x^{2}-1}+2x^{2}(3x)^{x^{2}}\ln(3x)[/tex]

To do this properly, we may define:
[tex]H(u,v,w)=uv^{w}, U(x)=x, V(x)=3x, W(x)=x^{2}[/tex]
Then, we may define the function:
[tex]h(x)=H(U(x),V(x),W(x))[/tex]
and we have, by the multi-variable chain rule:
[tex]\frac{dh}{dx}=(\frac{\partial{H}}{\partial{u}}\frac{dU}{dx}+\frac{\partial{H}}{\partial{v}}\frac{dV}{dx}+\frac{\partial{H}}{\partial{w}}\frac{dW}{dx})\mid_{(u,v,w)=(U(x),V(x),W(x)}[/tex]

Sure enough, and you can do find this out in various ways:
1. One variable chain rule
[tex]y=x^{x}=e^{x\ln(x)}=e^{u(x)},\frac{dy}{dx}=\frac{d}{du}e^{u}*\frac{du}{dx}=e^{u(x)}*(\ln(x)+x*\frac{1}{x})=x^{x}(1+\ln(x))[/tex]
2. Logarithmic differentiation:
[tex]Y(x)=\ln(y(x))=x\ln(x),\frac{dY}{dx}=\ln(x)+1=\frac{dY}{dy}\frac{dy}{dx}\to\frac{1}{y(x)}\frac{dy}{dx}=1+\ln(x)\to\frac{dy}{dx}=y(x)(1+\ln(x))=x^{x}(1+\ln(x))[/tex]
3. Multivariable chain rule (regard one x as constant, the others varying, then add the results)):
[tex]\frac{dy}{dx}=x*x^{x-1}+x^{x}\ln(x)=x^{x}(1+\ln(x))[/tex]