If $T$ and $S$ are linear, then $(S\circ T)(ax+by)=S(aT(x)+bT(y))=aS(T(x))+bS(T(y))$. Thus composition is linear. This identity explains the compatibility of matrix multiplication with linear transformations.