This doesn't hold for diagonal matrices $A$ in general, unfortunately. Consider
$$A=\begin{bmatrix} 1 & & \\ & 2 & \\ & & 3 \end{bmatrix}$$
and
$$U = \begin{bmatrix}  & & 1 \\1 &  & \\ & 1& \end{bmatrix}$$
Then
$$UAU^\mathrm{t}=\begin{bmatrix}
 3 &  &  \\
  & 1 &  \\
  &  & 2 \\
\end{bmatrix} \neq A$$

If $UAU^\mathrm{t}=A$, then $UA=AU$; so $A$ commutes with all orthogonal matrices and must be a multiple of the identity matrix. To see this more clearly, suppose $v$ is an eigenvector of $A$ with eigenvalue $\lambda$. Then for all $u\in\mathbb{R}^3$ there is an orthogonal matrix $U$ such that $Uv=u$ (and thus $U^\mathrm{t}u=v$), and $$Au=UAU^\mathrm{t}u=UAv=\lambda Uv=\lambda u,$$ so every vector is an eigenvector of $A$ with eigenvalue $\lambda$. Thus $A=\lambda I$.