You wrote:
$$\mathrm{d}G = \mathrm{d}H - T\,\mathrm{d}S = \mathrm{d}H - đq$$
There are several issues with this. I don't wish to co-opt other answers and comments, but allow me to mention these here, since my answer stands as the accepted (which I have no power to change):
- You haven't assumed constant temperature, which means that there is an additional term $-S\,\mathrm{d}T$ which you did not take into account;
- You haven't assumed constant composition, which likewise leads to another term $\sum_i \mu_i\,\mathrm{d}n_i$.
In fact, these considerations (particularly the second) are more important than my original point, which is retained below. See Kexanone's answer for discussion of these points. In the following discussion, one should assume constant temperature and composition.
In the second equality, where you equate $đq$ with $T\,\mathrm{d}S$, this assumes that the process is reversible. Without going into too much detail (it can be found easily elsewhere), entropy is defined by the following equation:
$$\mathrm{d}S = \frac{đq_\mathrm{rev}}{T}$$
where the subscript $\mathrm{rev}$ indicates a reversible process. It can be shown that for an irreversible process,
$$\frac{đq_\mathrm{irrev}}{T} < \frac{đq_\mathrm{rev}}{T} = \mathrm{d}S$$
This result is the second law of thermodynamics. Therefore, for an irreversible process, $T\mathrm{d}S > đq$.
You are right in saying that at constant pressure, $\mathrm{d}H = đq$. Putting it all together, we have:
$$\mathrm{d}G = \mathrm{d}H - T\mathrm{d}S = đq - T\mathrm{d}S < 0 \qquad \text{(irrev. process; closed system; }p, T\text{ const.)}$$
Therefore, the direct answer to the question is: $\mathrm{d}G$ is, in general, not equal to $0$ because $T\mathrm{d}S \neq đq$.
In fact, you may notice that the condition $\mathrm{d}G < 0$ is the condition for spontaneity under constant $p$ and $T$. This is no coincidence. The concepts of spontaneity (in the context of $G$) and irreversibility (in the context of $S$) are extremely similar, in that they both refer to a tendency for a process to proceed.
For a reversible process, $T\mathrm{d}S = đq$. Following the logic that you used in your question, this means that $\mathrm{d}G = 0$, which is correct. If $\mathrm{d}G = 0$, the forward process cannot be spontaneous (that would require $\mathrm{d}G < 0$) and the reverse process cannot be spontaneous (that would require $\mathrm{d}G > 0$).
This can only mean one thing: the system is in equilibrium. Indeed, the condition for equilibrium at constant $p$ and $T$ is $\mathrm{d}G = 0$. And at this point, it should not come as a surprise that a reversible process is, by definition, one that is at equilibrium throughout.