The two algorithms are designed to solve slightly different problems.
Shewchuk's monograph is describing two different approaches to preconditioning the problem $Ax = b$ using a preconditioning matrix $M$.
Recall that when $A$ is symmetric and positive-definite, solving $Ax = b$ is equivalent to finding a minimizer of the (convex) functional
$$J(x) = \frac{1}{2}\langle Ax, x\rangle - \langle b, x\rangle.$$
While $M^{-1}A$ might have a smaller condition number than $A$, it might not be symmetric, even if both $M$ and $A$ are.
There are two ways to solve this.
First is the transformed approach, where we explicitly compute the Cholesky factorization $M = E^TE$ and solve a modified system using the matrix $E^{-1}AE^{-T}$, which is symmetric and positive-definite.
Second is what Shewchuk calls the untransformed approach.
Instead of factoring $M$, which is not always practical, we define a new inner product $\langle x, y\rangle_M = x^TMy$, which makes sense if $M$ is symmetric and positive-definite.
The operator $M^{-1}A$ is self-adjoint with respect to this inner product.
You can very easily write down what the CG algorithm looks like when you tweak the inner product and this effectively does preconditioning for you.
This latter approach can be really useful when solving finite-dimensional discretizations of infinite-dimensional problems.
This is going to get really confusing for a really stupid reason, which is that both of the works you referenced use the variable $A$ to refer to a matrix, but in each one the role of this matrix is different.
In the Nocedal and Wright book, their $G$ is Shewchuk's $A$.
Anyway, the algorithm in the optimization book is to solve a different, harder problem.
Rather than solve an unconstrained quadratic minimization problem, the algorithm from the book is for solving quadratic minimization problems with linear equality constraints.
It's the constraints that make life much harder.
The goal is to find a minimizer of the functional
$$J(x) = \frac{1}{2}\langle Gx, x\rangle - \langle c, x\rangle$$
subject to the constraint that
$$Ax = b.$$
Solving this equality-constrained problem is equivalent to solving the linear system
$$\left[\begin{matrix}G & A^\top \\ A & 0\end{matrix}\right]\left[\begin{matrix} x \\ \lambda\end{matrix}\right] = \left[\begin{matrix} c \\ b\end{matrix}\right]$$
where $\lambda$ is a Lagrange multiplier.
The projected CG algorithm works in the specific case when you have access to the orthogonal projection operator $P$ onto the null space of $A$.
In many circumstances you don't have access to the projection operator and will need to use another algorithm like Uzawa or MINRES.
Also, that algorithm in Nocedal and Wright doesn't include any preconditioning.
You can add that by emulating what Shewchuk does -- replace $G$ by $M^{-1}G$ and Euclidean inner products by $\langle\cdot,\cdot\rangle_M$.