Recall that - generally - in a domain a gcd is defined only up to associates, i.e. up to unit factors, In particular: $\,p,a\,$ are coprime means $\,\gcd(p,a)\approx 1,\,$ i.e. $\,d\mid p,a\iff d\mid 1\iff d\,$ is a unit.
The sought result is a bit more intuitive when viewed slightly more generally. By the Lemma below, in a PID, $\,p\,$ is irreducible $\iff (p)\,$ is a maximal ideal. Generally if $P$ is a maximal ideal we have
$$\begin{align} P\,\ {\rm max},\ P\not\supset A\,&\Rightarrow\, P\!+\!A = (1)\\[.2em]
{\rm so}\ \ p\,\ {\rm irred,}\ \ \ p\,\nmid\, a \,&\Rightarrow\, (p,\,a) = (1),\ \text{for $\,P\!=\!(p),\ A\!=\!(a)\,$ in a PID}\end{align}\qquad$$
therefore we conclude that $\ (1) = (p,a) = (\gcd(p,a)),\,$ so $\,p,a\,$ are coprime.
Lemma $ $ For principal ideals: $\ \rm\color{#0a0}{contains} = \color{#c00}{divides}$, $ $ i.e. $\,\color{#0a0}{(a)\supseteq (b)}\iff \color{#c00}{a\mid b},\,$ thus having no proper $\rm\color{#0a0}{containing}$ ideal (maximal) is the same as having no proper $\rm\color{#c00}{divisor}$ (irreducible), $ $ i.e.
$\qquad\quad\begin{eqnarray} (p)\,\text{ is maximal}
&\iff&\!\!\ (p)\, \text{ has no proper } \,{\rm\color{#0a0}{container}}\,\ (d)\\
&\iff&\ p\ \ \text{ has no proper}\,\ {\rm\color{#c00}{divisor}}\,\ d\\
&\iff&\ p\ \ \text{ is irreducible}\\
\end{eqnarray}$
Remark $ $ See also Euclid's Lemma in Bezout form, gcd form, and ideal form.