We investigate the magnetic and electronic properties of the Gd$T_2$Zn$_{20}$ ($T$ = Fe and Co) compounds using X-ray resonant magnetic scattering (XRMS), X-ray absorption near-edge structure (XANES) and X-ray magnetic circular dichroism (XMCD) techniques. The XRMS measurements reveal that the GdCo$_2$Zn$_{20}$ compound has a commensurate antiferromagnetic spin structure with a magnetic propagation vector $vec{tau}$ = $(frac{1}{2},frac{1}{2},frac{1}{2})$ below the Neel temperature ($T_N sim$ 5.7 K). Only the Gd ions carry a magnetic moment forming an antiferromagnetic structure with magnetic representation $Gamma_6$. For the ferromagnetic GdFe$_2$Zn$_{20}$ compound, an extensive investigation was performed at low temperature and under magnetic field using XANES and XMCD techniques. A strong XMCD signal of about 12.5 $%$ and 9.7 $%$ is observed below the Curie temperature ($T_C sim$ 85 K) at the Gd-$L_2$ and $L_3$ edges, respectively. In addition, a small magnetic signal of about 0.06 $%$ of the jump is recorded at the Zn $K$-edge suggesting that the Zn 4$p$ states are spin polarized by the Gd 5$d$ extended orbitals.