$ a\in \Bbb Z_n$ is invertible $\,\Rightarrow\gcd (a,n) =1$
Solution 1:
It is the special case $\,\color{0a0}{b = 1}\,$ of the following solvability criterion.
$\qquad \exists\, x\!:\ ax\equiv b\pmod{\! n}\iff \exists\, x,y\!:\ ax+ny = b\color{#c00}{\overset{\rm Bezout\!\!\!\!}\Longleftarrow}\!\color{}{\Longrightarrow}\, \gcd(a,n)\mid b $
Remark $\ $ The OP only requires the simpler black direction $\,(\Longrightarrow),\,$ not the deeper reverse arrow $(\color{#c00}\Longleftarrow)$ using $\rm\color{#c00}{Bezout's}\,$ identity for the gcd.
A more general ring-theoretic understanding comes from viewing it as a special case of the fact that zero-divisors are never invertible (in nonzero-rings).
Solution 2:
Assume $ab = 0$ and at the same time that $a$ is invertible. That means that there exists an $a^{-1}$ such that $a^{-1}a = 1$ But then we have $$ b = 1\cdot b = a^{-1}ab = a^{-1}\cdot 0 = 0 $$ so there cannot be a $b \neq 0$ such that $ab = 0$. That means that if there is such a $b$, then $a$ cannot be invertible.