Matrix equation $AX=B$
If $m < n$ then $A^TA$ will always be uninvertible. The reason is since $A$ was a map from $\Bbb{R}^n$ to $\Bbb{R}^m$ (in this case, a higher dimensional space to a lower dimensional one) we are guaranteed that there will be a nontrivial null space (in fact, $\dim \ker A \geq n-m)$. Even though $A^T$ is a map back to $\Bbb{R}^n$ from $\Bbb{R}^m$, we will not retrieve those lost dimensions due to linearity since if $v\in\ker A$
$$A^TAv = A^T 0 = 0$$
Another way of phrasing this is that if $m<n$, then $A^TA$ is guaranteed to have an eigenvalue of $0$.
For the reverse case when $m > n$, $A$ has a chance to, but not guaranteed to, be invertible. What we require in this case is for $A$ to be full rank, or $\dim \text{range }A = n $. If you are familiar with singular values, this is exactly the condition needed to guarantee that all singular values are nonzero.