The short answer is, $DG$ lies in the plane $BCD$ perpendicular to $AB$, and is therefore (parallel to a line) perpendicular to $AB$. $DG$ also lies in the plane $DFG$ perpendicular to $AC$, and therefore is (parallel to a line) perpendicular to $AC$. Being perpendicular to both $AB$ and $AC$, $DG$ is perpendicular to every line in the plane $ABC$ that it intersects, including both $FG$ and $BC$.
Let's walk through the derivation of all three formulas in detail. Following the linked article, we see:
First, from the slant face isosceles triangle $\triangle CAD$, using the right triangle with altitude $AE,$ and $AC=s,$ we have $EC=s\sin(\alpha/2).$
Altitude $AB$ is perpendicular to plane $CAD,$ so triangle $ABC$ is a right triangle, and we have $BC=AC\cos\gamma=s\cos\gamma.$ From the base isosceles triangle $\triangle CBD$ we have $EC=s\cos\gamma\sin(\beta/2).$
Equating the two expressions gives $$\cos\gamma = \frac{\sin\left(\frac\alpha2\right)}{\sin\left(\frac\beta2\right)}\tag{1}\label{1}.$$
Next, why are $FG$ and $BC$ (that is, plane $ABC$) perpendicular to $DG$?
The trick is to realize that the perpendicular to a plane through the vertex of a triangle is orthogonal to all lines in that plane, including the two edges that meet it, as well as (a parallel line to) the opposite edge.
By construction, plane $DFG$ is perpendicular to $AC$. Therefore $AC$ is perpendicular to any line in $DFG$, ergo $AC$ is perpendicular to $FG$ and $FD$.
Additionally, line $DG$ lies in plane $BCD,$ so it (or a line parallel to it) is perpendicular to $AB$, as $AB$ is perpendicular to plane $BCD.$ Line $DG$ is also in plane $DFG,$ so perpendicular to $AC$. Therefore it is perpendicular to plane $ABC.$ And therefore also to $FG.$ Angles $\angle DGF$ and $\angle DGC$ are right angles (line $BC$ is also in plane $ABC$ and so perpendicular to $DG$).
Therefore looking at right triangle $\triangle FGD$ we have $GD=s\sin\alpha\sin\delta.$
And looking at right triangle $\triangle BGD$ we see $GD=s\cos\gamma\sin\beta.$
Equating gives $$\sin\delta=\frac{\cos\gamma\sin\beta}{\sin\alpha} \stackrel{\eqref{1}}= \frac{\sin\left(\frac\alpha2\right)\cdot2\sin\left(\frac\beta2\right)\cos\left(\frac\beta2\right)}{\sin\left(\frac\beta2\right)\cdot2\sin\left(\frac\alpha2\right)\cos\left(\frac\alpha2\right)}=\frac{\cos\left(\frac\beta2\right)}{\cos\left(\frac\alpha2\right)}\tag{2}\label{2}.$$
Looking at right triangle $\triangle ABE$ we have $BE=AE\cos\epsilon.$
From triangle $\triangle AEC$ we have $AE=s\cos\left(\frac\alpha2\right).$
And from triangle $\triangle BEC$ we have $BE=s\cos\left(\gamma\right)\cos\left(\frac\beta2\right).$
Thus $$\cos\epsilon=\frac{\sin\left(\frac\alpha2\right)\cos\left(\frac\beta2\right)}{\cos\left(\frac\alpha2\right)\sin\left(\frac\beta2\right)}=\frac{\tan\left(\frac\alpha2\right)}{\tan\left(\frac\beta2\right)}\tag{3}\label{3}.$$
So given the vertex angle $\alpha$ and the projection of that angle into the base $\beta$, we have the edge angle $\gamma$, the dihedral angle $\delta$ between $ABC$ and $ACD$, and the dihedral angle $\epsilon$ between $ACD$ and $BCD$.
Applying this to the regular pyramid, where $CAD$ is a lateral face and $\triangle ABC$ is a vertical (perpendicular to the base) cross section through an edge between adjacent faces, then the dihedral angle between adjacent side faces is $2\delta.$
In terms of the number of sides of the pyramid $n$, since there are $n$ angles of measure $\beta$ around a vertex in the plane, we have $$\beta=\frac{2\pi}{n}.$$ And in terms of the slant edge length $AC=s$, and base side length $CD=\ell$, we have $$\ell=2s\sin\left(\frac\alpha2\right).$$ So in terms of $n,\ell,$ and $s,$ we write $$\begin{align}\cos\gamma&=\frac{\ell}{2s\sin\left(\frac{\pi}{n}\right)},\\\sin\delta&=\frac{2s\cos\left(\frac{\pi}{n}\right)}{\sqrt{4s^2-\ell^2}},\\\cos\epsilon&=\frac{\ell}{\tan\left(\frac{\pi}{n}\right)\sqrt{4s^2-\ell^2}}.\end{align}$$
For example, putting $n=4$, $s=\ell$ gives us the regular square pyramid with $\gamma=\frac{\pi}{4},$ $\sin\delta=\sqrt{\frac{2}{3}},$ and $\cos\epsilon=\frac{1}{\sqrt{3}}.$ Which matches the angles of the regular octahedron in the table of Platonic solid dihedral angles.
Or with $n=3$, $s=\ell$ we get $\cos\gamma=1/\sqrt{3}$ and $\cos(2\delta)=\cos\epsilon=1/3,$ again agreeing with known geometry of the regular tetrahedron.
For a non-Platonic example, a regular hexagonal pyramid with height $h=\sqrt{3}\ell$ and slant edge length $s=2\ell$ will have $\cos(2\delta)=-3/5$, the angle of a $3$-$4$-$5$ triangle.