It is a special case of $\,(1\Rightarrow 2)\,$ below. It will be much more "obvious" when you study ideals. Then $\,(1)\!\!\iff\!\!(2)\,$ below boils down to the following, using $\color{darkorange}{\rm U} = $ universal property of ideal sums, and using contains = divides for principal ideals
$$\bbox[7px,border:2px solid #c00]{\begin{align} &dZ \,\supseteq\, aZ+bZ\, \smash[t]{\overset{\color{darkorange}{\rm U}\!\!}\iff}^{\phantom|} \!dZ\supseteq\, aZ,\ bZ\,\iff \color{#c00}{d\mid a,b}\\[.3em]
& dZ \,\subseteq\, aZ+bZ \iff d\,\in\, aZ+bZ\iff \color{#0a0}{d = ax\!+\!by}\ \ \text{for some } \,x,y\in Z\,\end{align}}\quad $$
Note the righmost $\rm\color{#c00}{state}\color{#0a0}{ments}$ imply $\,d=\gcd(a,b),\,$ since the $\rm\color{#c00}{top}\Rightarrow\,\color{#c00}d\,$ is a common divisor, which is necessarily greatest by the $\rm\color{#0a0}{bottom}$: $\,c\mid a,b\Rightarrow\,c\mid \color{#0a0}{d\!=\!ax\!+\!by}\,$ [$\Rightarrow\, |c|\le |d|\,$ in $\Bbb Z\,$], i.e. common divisors of $\rm\color{#0a0}{linear\ form}$ are necessarily greatest (the gist of the Bezout GCD identity).
But, alas, this innate structure is a bit obfuscated without the ideal theoretic viewpoint. Eliminating ideal language (for "middle school" students), obscures the key ideas, leaving the mostly unmotivated (though simple) algebra below.
Lemma $ $ TFAE for $\,a,b,d\in Z\,$ any Bezout domain, e.g. $\,Z = \Bbb Z =$ ring of integers.
$(0)\ \ \ \gcd(a,b) = d,\ $ i.e. $\ c\mid a,b\iff c\mid d\,\ $ (i.e. $\ d\mid a,b\ $ and $\ c\mid a,b\,\Rightarrow\, c\mid d)$
$(1)\ \ \ \exists\, x,y\!:\ ax + b y = d,\,$ and $\,d\mid a,b$
$(2)\ \ \ \ a\,Z + b\, Z = d\,Z,\ $ i.e. $\,\{ax+by\ :\ x,y\in Z\} = \{dz\ :\ z\in Z\}$
Proof $\ \ (0\Rightarrow 1)\ \ \gcd(a,b)=d\,\Rightarrow\, ax\!+\!by = d\,$ by Bezout. $\ (1\Rightarrow 0)\ \ \ c\mid a,b\Rightarrow c\mid d = ax\!+\!by$
$ (2\Rightarrow 1)\ \ \,d = d(1)\in dZ\subseteq aZ + bZ\,\Rightarrow\, d\! =\! ax\! +\! by\,$ for some $\,x,y\in Z.\,$
$\,a = a(1)+b(0)\in aZ + bZ\subseteq dZ \,\Rightarrow\, a = dx,\ x\in Z\,\Rightarrow\, d\mid a\,$ in $Z.\,$ Similarly $\,d\mid b$.
$(1\Rightarrow 2)\ \ \ c\in dZ\,\Rightarrow\, c = dn = (ax\!+\!by)n = a(xn)\! +\! b(yn)\in aZ+bZ,\ $ so $\ dZ\subseteq aZ+bZ$.
$d|a,b\Rightarrow a,b = d\bar a,d\bar b\,$ so $\,c\in aZ \!+\! bZ\Rightarrow c = ax\!+\!by = d(\bar a x\! +\! \bar b y)\in d Z,\,$ so $\,aZ\!+\!bZ\subseteq dZ$.
Remark $ $ As we see above $\ aZ + bZ = dZ \,\Rightarrow\, \gcd(a,b) = d\ $ holds in any domain. The reverse (Bezout identity) generally does not, e.g. in the UFDs $\,\Bbb Z[x]\,$ and $\,\Bbb Q[x,y]\,$ we have $\,\gcd(2,x)=1\,$ and $\,\gcd(x,y)=1\,$ but there is no Bezout identity for those gcds (if it existed then evaluating at $\,x,y=0\,$ yields a contradiction, viz. $\,2\mid 1\,$ in $\Bbb Z,\,$ or $\,0\mid 1$ in $\Bbb Q$.