Recall the following log rule:
> $$\log_2 (x^k) = (k)(\log_2 x) \tag{1}$$
Now to prove that $3^{\log_2 n} = n^{\log_2 3}$, it suffices to prove that their logs (base $2$) are equal. Indeed, observe that: \begin{align*} \log_2(3^{\log_2 n}) &= (\log_2 n)(\log_2 3) &\text{by (1), where $x = 3$ and $k = \log_2 n$} \\\ &= (\log_2 3)(\log_2 n) &\text{by the commutativity of multiplication} \\\ &= \log_2(n^{\log_2 3}) &\text{by (1), where $x = n$ and $k = \log_2 3$} \\\ \end{align*} as desired. $~~\blacksquare$