Why it works
After 8.O-O-O the e4-pawn looks like a free meal: the black queen on e7 sees that taking it 'attacks' White's queen on a4 along the fourth rank, so any recapture should just trade queens. 8...Qxe4?? misses the zwischenzug: 9.Rd8+!! drags the king onto d8 first, and only then 10.Qxe4 — the queen trade Black counted on never happens, because the piece that would have recaptured is now a king standing on the wrong square. Castling long put the rook on d1 for exactly this trick.
Refutation
8...Bd7 calmly finishes development and defends: the engine has White only slightly better (+0.9), mostly thanks to Black's earlier loose 7...Qe7 (7...Be7 was the cleaner path). The e4-pawn stays poisoned as long as the d-file check exists — remove the trick with ...Bd7 or ...O-O-O ideas first, take second.