[proofplan]
Since $W$ is $T$-invariant, the restriction $T|_W: W \to W$ is a well-defined linear operator. We show that $m_T$ annihilates $T|_W$, and then the minimality of $m_{T|_W}$ forces $m_{T|_W} \mid m_T$.
[/proofplan]
[step:Verify that $T|_W$ is well-defined and that polynomial evaluation commutes with restriction]
Since $W$ is $T$-invariant ($T(W) \subset W$), the restriction $T|_W: W \to W$ is a well-defined linear operator. For any polynomial $f \in k[\lambda]$, we claim that $f(T)|_W = f(T|_W)$. This follows by induction on $\deg f$: for $f(\lambda) = \lambda$, $T|_W$ is the restriction by definition; for sums and products, the operations on $\operatorname{End}(V)$ restrict to $\operatorname{End}(W)$ because $W$ is $T$-invariant. Formally, if $f(\lambda) = \sum_{j=0}^d a_j \lambda^j$, then for any $w \in W$:
\begin{align*}
f(T)|_W(w) = \sum_{j=0}^d a_j T^j(w) = \sum_{j=0}^d a_j (T|_W)^j(w) = f(T|_W)(w),
\end{align*}
where $T^j(w) = (T|_W)^j(w)$ holds because each successive application of $T$ to an element of $W$ remains in $W$ by $T$-invariance.
[/step]
[step:Show $m_T(T|_W) = 0$ and conclude $m_{T|_W} \mid m_T$]
Since $m_T(T) = 0$ as an operator on $V$, we have $m_T(T) w = 0$ for every $w \in W \subset V$. By the previous step, $m_T(T|_W) w = m_T(T)|_W(w) = m_T(T) w = 0$ for every $w \in W$. Therefore $m_T(T|_W) = 0$ as an operator on $W$.
Now $m_{T|_W}$ is the monic polynomial of least degree annihilating $T|_W$, and $m_T$ also annihilates $T|_W$. By the division algorithm in $k[\lambda]$, write $m_T = q \cdot m_{T|_W} + r$ with $\deg r < \deg m_{T|_W}$ or $r = 0$. Evaluating at $T|_W$ gives
\begin{align*}
0 = m_T(T|_W) = q(T|_W) \, m_{T|_W}(T|_W) + r(T|_W) = 0 + r(T|_W),
\end{align*}
so $r(T|_W) = 0$. By minimality of $\deg m_{T|_W}$, we must have $r = 0$. Therefore $m_{T|_W} \mid m_T$ in $k[\lambda]$.
[guided]
The argument has two ingredients. First, any polynomial in $T$ restricts to the same polynomial in $T|_W$ on the subspace $W$. This is because $T$-invariance of $W$ ensures that $T^j(W) \subset W$ for all $j \ge 0$: the base case $j = 0$ is the identity, and if $T^j(W) \subset W$ then $T^{j+1}(W) = T(T^j(W)) \subset T(W) \subset W$ by $T$-invariance. Therefore the entire polynomial expression $f(T) = \sum_{j=0}^d a_j T^j$ maps $W$ into $W$, and for any $w \in W$:
\begin{align*}
f(T)|_W(w) = \sum_{j=0}^d a_j T^j(w) = \sum_{j=0}^d a_j (T|_W)^j(w) = f(T|_W)(w).
\end{align*}
Second, since $m_T$ annihilates $T$ globally ($m_T(T) = 0$ on all of $V$), it annihilates $T|_W$ in particular: $m_T(T|_W) w = m_T(T) w = 0$ for every $w \in W$. The minimal polynomial $m_{T|_W}$ is the monic generator of the annihilator ideal $\{f \in k[\lambda] : f(T|_W) = 0\}$ in the PID $k[\lambda]$. Since $m_T$ lies in this ideal, $m_{T|_W} \mid m_T$.
Note that the converse divisibility does not hold in general: $m_T$ need not divide $m_{T|_W}$, and typically $m_{T|_W}$ is a proper divisor of $m_T$. For example, if $T$ has two distinct eigenvalues $\lambda_1, \lambda_2$ and $W$ is the $\lambda_1$-eigenspace, then $m_{T|_W} = \lambda - \lambda_1$ while $m_T$ is divisible by both $(\lambda - \lambda_1)$ and $(\lambda - \lambda_2)$.
[/guided]
[/step]