It's not so much that they're compatible - but rather the GPL explicitly allows relicensing of GPL code under the AGPL. The combined work must be AGPL licensed.
> Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.