Why it works
After 4...g6?? Black weakens the a2-g8 diagonal (f7 is now under the bishop on c4) and misses a hidden queen sacrifice. White plays 5.Nxe5! — apparently a blunder: the knight is attacked by the pinned bishop on g4. The greedy 5...Bxd1?? looks winning: Black takes the queen. But it dissolves the pin — the e5 knight is now free, and White forces mate: 6.Bxf7+ Ke7 (Kxf7 is illegal — the bishop is defended by the e5 knight), and 7.Nd5# — the c3 knight jumps to d5 delivering mate. The king on e7 has no escape: d6 — own pawn, d7 — covered by the e5 knight, e6/e8/g8 — bishop on f7, d8 — own queen, f6/f8 — knight on d5 and own bishop. The most famous trap in chess history (18th century, Sire de Légal de Kermeur).
Refutation
5...dxe5! — the only correct move. Black simply takes the knight and remains up a piece, the bishop pin on the (now gone) f3-knight having served its purpose. After 5...dxe5 Black is fine: a piece for a pawn, healthy development.