First, each matrix has a unique structure of Jordan normal form. It consists of Jordan cells of the form $$J_\lambda=\begin{pmatrix}\lambda&1&0&\dots&\dots\\0&\lambda&1&0&\dots\\ \vdots&0&\ddots&\ddots&\ddots\\0&\dots&\dots&\lambda&1\\0&\dots&\dots&0&\lambda\end{pmatrix}$$
The size of this cell is called its order - denote it $ord(J_\lambda)$. Easy to see that $(J_\lambda-\lambda I)^{ord(J_\lambda)}=0$.
If $\mu\ne \lambda$, then $\det(J_\lambda-\mu I)^l\ne0$ for all $l$.
Finally, we take the whole JNF and study $(J-\lambda)^{a_\lambda}$. Clearly, $$a_\lambda = \text {sum of orders of all cells corresponding to $\lambda$}$$
by definition of algebraic multiplicity. Therefore, each such cell to the power $a_\lambda$ is zero and all other cells are non-singular. Thus, $$\dim\ker (J-\lambda)^{a_\lambda} =\dim\ker (A-\lambda)^{a_\lambda} = \text {sum of orders of all cells corresponding to $\lambda$}=a_\lambda.$$