If you know about the theorem that says that a linear operator on a finite dimensional vector space over$~F$ is diagonalisable (over$~F$) if and only if it is annihilated by some polynomial that can be decomposed in$~K[X]$ as a product of distinct factors of degree$~1$, then this is easy. Let by the theorem $P$ be such a polynomial for the diagonalisable operator$~T$ (so $P[T]=0$), then certainly $P[T|_U]=0$ and $P[T|_W]=0$, which by the same theorem shows that $T|_U$ and $T|_W$ are diagonalisable. In this high level answer it is irrelevant that both $U,W$ are given, and that they form a direct sum; it shows that more generally the restriction of a diagonalisable operator$~T$ to any $T$-stable subspace is diagonalisable.
There is however a more low level reasoning that applies for this question, based on the fact that the projections on the factors of a $T$-stable direct sum decomposition commute with$~T$. This fact is immediate, since if $v=u+w$ with $u\in U$ and $w\in W$ describes the components of$~u$, then $Tv=Tu+Tw$ with $Tu\in U$ and $Tw\in W$ by $T$-stability, so it describes the components of$~Tv$. This means in particular that the projections on $U$ and $W$ of an eigenvector of$~T$ for$~\lambda$ are again eigenvectors of$~T$ for$~\lambda$ (or one of them might be zero), as the projection of $Av=\lambda v$ is $\lambda$ times the projection of$~v$.
Now to show that $T|_U$ and $T|_W$ are diagonalisable, it suffices to project every eigenspace$~E_\lambda$ onto$~U$, and onto$~W$; its images are eigenspaces for$~\lambda$ of $T|_U$ and $T|_W$, or possibly the zero subspace. As it is given that $V=\bigoplus_\lambda E_\lambda$, the sums of the projections of the spaces $E_\lambda$ in $U$ respectively $W$ (which sums are always direct) fill up $U$ respectively $W$, in other words $T|_U$ and $T|_W$ are diagonalisable. Alternatively, to decompose a vector $u\in U$ as a sum of eigenvectors for $T|_U$, just decompose it into a sum of eigenvectors for$~T$, and project the summands onto$~U$ (parallel to$~W$), which projections clearly add up to$~u$ (and in fact it is easy to see that the projections did nothing; the eigenvectors for$~T$ were already inside$~U$).
Just one final warning: don't take away from this that projections onto $T$-stable subspaces always commute with$~T$, or send eigenspaces to eigenspaces for the restriction. That is not true in general: it only holds when the projection is along another $T$-stable subspace.