In the last line, $X$ is the random variable. In the next-to-last line, $y$ is a dummy variable that steps through all the possible values of $X$, so it can be called anything. It could even be called $x$, but the author changed the name of the dummy to explain the substitution more clearly to the reader.
The important thing about $x$ and $y$ is that the summand takes on exactly the same set of values as $x$ and $y$ step through their specified values: as $x$ steps through its range $0,1,2,\ldots$, the value of $x+1$ in the summand takes the values $1,2,3,\ldots$; as $y$ steps through its range $1,2,3,\ldots$, the value of $y$ in the summand (which appears where $x+1$ appeared before) takes on the same set of values $1,2,3,\ldots$. So in the end, the same set of summands occurs in both cases.