To quote the introductory words of Wilf in Chapter 1 of his excellent book "generatingfunctionology",
A generating function is a clothesline on which we hang up a sequence of numbers for display.
Specifically, to answer your question on what it means to talk of the "generating function of a sequence": Given a sequence $a_0, a_1, a_2, \dots$, the generating function of that sequence is the object $A(x) = a_0 + a_1x + a_2x^2 + \dots$. This is a way of encoding all the elements of the sequence into a single object.
For instance, consider the very simple sequence defined by $a_n = 1$ for all $n$. Its generating function is the object $A(x) = 1 + x + x^2 + \dots$, which can also (if you wish) be written more concisely as $\dfrac{1}{1-x}$. Or, consider the sequence defined by $a_n = 2^n$. The generating function of this sequence is the object $A(x) = 1 + 2x + 2^2x^2 + 2^3x^3 + \dots$, which can also be written as $\dfrac{1}{1-2x}$. Note that this gives a way to encode all the (infinitely many) elements of the sequence $1, 2, 2^2, 2^3, \dots$ into a single object $A(x)$. (Of course there are other ways too: you could say that the function $n \mapsto 2^n$ is a single object.)
Anyway, now that you hopefully understand roughly what generating functions are, we can turn to their use in counting problems. In general, when we want to find an element of some sequence, one way is to find the generating function of the whole sequence first, and then find the particular element we care about. This may seem like more work, but in practice can often be simpler.
So, let $a_n$ be the number of solutions to $3a + 4b + 2c + d = n$; we want to find the generating function $A(x) = a_0 + a_1x + a_2x^2 + \dots$ and then read off $a_{20}$ which is the coefficient of $x^{20}$ in it. All this should answer what generating functions are here, why take coefficient of $x^{20}$ etc.
The actual part related to the counting problem is relatively simple (though nontrivial) once you understand all this: if you consider $(1 + x^3 + x^6 + \dots)$, the coefficient of $x^k$ in this is $1$ if $k$ can be written as $3a$ for some $a$, and $0$ otherwise. Similarly the other factors. For any solution $(a, b, c, d)$ satisfying $3a + 4b + 2c + d = n$, when you multiply the four factors $(1+x^3+x^6+\dots)(1+x^4+x^8+\dots)(1+x^2+x^4+\dots)(1+x+x^2+\dots)$ together, you'll get a bunch of terms, where each term in the product is got by taking one particular term from each of the factors, and multipying those four terms together. One of the particular products is that of taking $x^{3a}$ from the first factor, $x^{4b}$ from the second, etc., to give $x^{3a}x^{4b}x^{2c}x^{d} = x^{3a + 4b + 2c + d} = x^n$. Each solution $(a, b, c, d)$ contribues one such term $x^n$, and these solutions are the only way to get $x^n$ in the product. So the coefficient of $x^n$ is the number of times it occurs in the product, which is the number of solutions.
Best Answer
If $X$ is a discrete random variable taking values in the non-negative integers $\{0,1, \dots\}$, then the probability generating function of $X$ is defined as:
$$\color{blue}{\displaystyle G(z)=\mathbb{E} \left(z^{X}\right)=\sum_{x=0}^{\infty }p(x)\;z^{x}}$$
where $p$ is the probability mass function of $X$. The choice of $z$ instead of $x$ is simply related to the idea that what we are doing is a z transform.
Notice in what follows that $z$ is acting like a clothesline to hang up the values of interest, which are recovered after differentiating, and evaluating at $0$ to recover the PMF, or at $1$ for the moments, respectively. This magic happens thanks to the fact that $z$ either becomes $0$ in the entire tail of terms (PMF), or $1.$ But in either case it is not related to the random variable, and does not contribute any information - it is the equivalent of a dummy variable.
CHARACTERISTICS:
$$\color{blue}{\large p_i = \left. \frac{1}{i!}\quad\frac{d^i \, G(z)}{dx^i} \right|_{z=0}=\frac{1}{i!} \;G^{(i)}\;(0)}$$
$G\,(1)=1$ because $$\displaystyle\sum_{i=0}^\infty p_i \; 1^i=1$$
First differential
$$G^{(1)}(z) =\frac{d}{dz}\mathbb E\left[z^X\right]=\mathbb E\left[X\,z^{X-1}\right]$$
The first differential evaluated at $1$ gives you the mean: $$G^{(1)}(1) =\left.\mathbb E\left[X\,z^{X-1}\right]\right|_{z=1}=\mathbb E\left[X\quad1^{X-1}\right]= \mathbb E[X].$$
The second derivative evaluated at $1$ is the factorial momment, and is NOT the variance, because the second term is not squared.
$$\begin{align}G^{(2)}\;(1) &=\frac{d^2}{dz^2}\; \left.\mathbb E\left[z^X\right]\right|_{z=1}\\[2ex]&=\mathbb E\left[X\;(X-1)\;z^{X-2}\right]\\[2ex]&=\mathbb E\left[X\;(X-1)\right]\\[2ex]&=\mathbb E\left [X^2-X\right ]\\[2ex]&=\mathbb E\left[X^2\right] - \mathbb E\left[X\right]\end{align}$$
$$G^{(i)}\;(1)= \mathbb E\left[X\;(X-1)\;\cdots\;(X-i+1)\right]$$
$$\begin{align}\sigma^2 &= \mathbb E\left[X^2\right]-\mathbb E\left[X\right]^2 \\[2ex] &=G^{(2)}\;(1)+G^{(1)}\;(1)-\left[G^{(1)}\;(1)\right]^2 \end{align}$$
$$\mathbb E\left[X^i\right]= \left. \left( z\;\left(\frac{d}{dz}\right)^i \; G(z)\right)\right|_{z=1}$$