Suppose $M=(m_{ij})$ is the matrix representation of $T$ under a certain basis $B=\\{v_1,\ldots,v_n\\}$. Then \begin{align*} T^2(v_j) &= T\left(T(v_j)\right)\\\ &= T\left( \sum_{k=1}^n m_{kj}v_k \right)\\\ &= \sum_{k=1}^n m_{kj} T(v_k)\\\ &= \sum_{k=1}^n m_{kj} \sum_{i=1}^n m_{ik} v_i\\\ &= \sum_{i=1}^n \left(\sum_{k=1}^n m_{ik} m_{kj}\right) v_i. \end{align*} Since $\sum_{k=1}^n m_{ik} m_{kj}$ is, by definition, the $(i,j)$-th entry of $M^2$, the result follows.