There is no contradiction here. The change in Gibbs free energy tells you the maximum extractable work and at constant teperature and pressure $dG = 0$. The conclusion here is that you can extract no work while maintaining a fixed temperature and pressure.
Why is this? Well you have 5 variables in your thermodynamic system $U, p, V, T$ and $S$. We can replace $U$ with $G$ in our list using $G = U +pV - TS$. Now we know from the fundamental relation that
\begin{align}
G &= G(p,T)\\
V &= \left(\frac{\partial G}{\partial p}\right)_T\\
S &= \left(\frac{\partial G}{\partial T}\right)_p
\end{align}
So we have 5 variables and 3 constraint, leaving us with 2 degrees of freedom in our system. If we now impose another 2 constants, say by fixing $p$ and $T$, we have fully defined the state of our system. This means under these conditions we can extract no work because there is no other state we can move to in the transition.
If we do want to extract some useful work from our system there are 2 things we can do; either we can relax one of our constraints, say by allowing temperature to vary, or we can introduce additional physical degrees of freedom to the system, for example by allowing particle number to vary, and modify the expression for the change in $G$ accordingly, as @higgsss describes in they're answer.