Why it works
A Dragon without ...d6 — that's the whole trap. 5...g6 doesn't lose by itself, but it neither covers d6 nor closes the a1-h8 diagonal. White takes with 6.Nxc6! bxc6 (Black's structure is ruined) and immediately plays 7.e5!, pushing the pawn with tempo. After 7...Nd5 8.Nxd5 cxd5 9.Qxd5 the queen sits in the centre eyeing both rooks while Black has yet to develop a single piece. Then 10.e6! is a wedge that blocks the f8 bishop and forces the f-pawn to move. The finish is decided: 11.Qe5 hits the rooks on b8 and h8 at once, and both cannot be saved.
Refutation
5...d6! — move order in the Dragon is not cosmetic. The d6 pawn closes the diagonal, denies White the e5 square and makes the whole Nxc6-and-e5 operation pointless. Only then do ...g6 and ...Bg7 make sense.