Do you know about the equivariant rank theorem?
One way I know to prove this (from Lee's Smooth Manifolds) is to define the map to be
$F(A) = A^TA$
which is a map from the general linear group $GL(n)$ to the symmetric group $S(n)$. The orthogonal group is then $F^{-1}(I)$.
Then, the equivariant rank theorem says
Let $M$ and $N$ be smooth manifolds and let $G$ be a Lie group. Suppose $F: M \to N$ is a smooth map that is equivariant with respect to a transitive smooth $G$-action on $M$ and any smooth $G$-action on $N$. Then $F$ has constant rank.
Equivariant means $F(g\cdot p) = g\cdot F(p)$ (for a left action) or $F(p \cdot g) = F(p) \cdot g$ (for a right action).
You can take $M = GL(n)$, $N = S(n)$, and $G = GL(n)$. At this point, you may want to try coming up with the actions on your own, but I'll put them below in a spoiler tag in case you get stuck.
Let $GL(n)$ act on $M$ (i.e. itself) by right multiplication (it's clear why this is transitive, right?), and on $N$ by conjugation, i.e. $X \cdot B = B^TXB$. Then equivariance follows:
$F(A \cdot B) = F(AB) = (AB)^T(AB) = B^TA^TAB = B^TF(A)B = F(A) \cdot B$