Let us address the question posed, This is all somewhat mysterious to me. Is the normal distribution fundamental to the derivation of the gamma distribution...? No mystery really, it is simply that the normal distribution and the gamma distribution are members, among others of the exponential family of distributions, which family is defined by the ability to convert between equational forms by substitution of parameters and/or variables. As a consequence, there are many conversions by substitution between distributions, a few of which are summarized in the figure below.
LEEMIS, Lawrence M.; Jacquelyn T. MCQUESTON (February 2008). "Univariate Distribution Relationships" (PDF). American Statistician. 62 (1): 45–53. doi:10.1198/000313008x270448 cite
Here are two normal and gamma distribution relationships in greater detail (among an unknown number of others, like via chi-squared and beta).
First A more direct relationship between the gamma distribution (GD) and the normal distribution (ND) with mean zero follows. Simply put, the GD becomes normal in shape as its shape parameter is allowed to increase. Proving that that is the case is more difficult. For the GD,
GD(z;a,b)=⎧⎩⎨⎪⎪⎪⎪⎪⎪b−aza−1e−zbΓ(a)0z>0other.
As the GD shape parameter a→∞, the GD shape becomes more symmetric and normal, however, as the mean increases with increasing a, we have to left shift the GD by (a−1)1a−−√k to hold it stationary, and finally, if we wish to maintain the same standard deviation for our shifted GD, we have to decrease the scale parameter (b) proportional to 1a−−√.
To wit, to transform a GD to a limiting case ND we set the standard deviation to be a constant (k) by letting b=1a−−√k and shift the GD to the left to have a mode of zero by substituting z=(a−1)1a−−√k+x . Then
GD((a−1)1a−−√k+x; a, 1a−−√k)=⎧⎩⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪(ka−−√)−ae−a−−√xk−a+1((a−1)ka−−√+x)a−1Γ(a)0x>k(1−a)a−−√other.
Note that in the limit as a→∞ the most negative value of x for which this GD is nonzero →−∞. That is, the semi-infinite GD support becomes infinite. Taking the limit as a→∞ of the reparameterized GD, we find
lima→∞(ka√)−ae−a√xk−a+1((a−1)ka√+x)a−1Γ(a)=e−x22k22π−−√k=ND(x;0,k2)
Graphically for k=2 and a=1,2,4,8,16,32,64 the GD is in blue and the limiting ND(x;0, 22) is in orange, below
Second Let us make the point that due to the similarity of form between these distributions, one can pretty much develop relationships between the gamma and normal distributions by pulling them out of thin air. To wit, we next develop an "unfolded" gamma distribution generalization of a normal distribution.
Note first that it is the semi-infinite support of the gamma distribution that impedes a more direct relationship with the normal distribution. However, that impediment can be removed when considering the half-normal distribution, which also has a semi-infinite support. Thus, one can generalize the normal distribution (ND) by first folding it to be half-normal (HND), relating that to the generalized gamma distribution (GD), then for our tour de force, we "unfold" both (HND and GD) to make a generalized ND (a GND), thusly.
The generalized gamma distribution
GD(x;α,β,γ,μ)=⎧⎩⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪γe−(x−μβ)γ(x−μβ)αγ−1βΓ(α)0x>μother,
Can be reparameterized to be the half-normal distribution,
GD(x;12,π−−√θ,2,0)=⎧⎩⎨⎪⎪⎪⎪⎪⎪2θe−θ2x2ππ0x>0other=HND(x;θ)
Note that θ=π√σ2√. Thus,
ND(x;0,σ2)=12HND(x;θ)+12HND(−x;θ)=12GD(x;12,π−−√θ,2,0)+12GD(−x;12,π−−√θ,2,0),
which implies that
GND(x;μ,α,β)=12GD(x;1β,α,β,μ)+12GD(−x;1β,α,β,μ)=βe−⎛⎝⎜|x−μ|α⎞⎠⎟β2αΓ(1β),
is a generalization of the normal distribution, where μ is the location, α>0 is the scale, and β>0 is the shape and where β=2 yields a normal distribution. It includes the Laplace distribution when β=1. As β→∞, the density converges pointwise to a uniform density on (μ−α,μ+α). Below is the generalized normal distribution plotted for α=π√2,β=1/2,1,4 in blue with the normal case α=π√2,β=2 in orange.
The above can be seen as the generalized normal distribution Version 1 and in different parameterizations is known as the exponential power distribution, and the generalized error distribution, which are in turn one of several other generalized normal distributions.