Do the standard scan of the lines leading away from White’s king. Do you see a pinning possibility? It’s easy to overlook the bishop on e3, but there it is: a piece lined up with its king. We know that a bishop on its king’s diagonal is itself an unsuitable target for a pin, but we also know that it sometimes can be swapped out for a better one. If Black plays RxB, White has to reply QxR to recoup his loss; and now White’s queen and king would be aligned. Would Black have a tool usable to impose a pin? Yes; his fianchettoed dark-squared bishop on g7 is poised to move to d4.
One difficulty remains, though: Black needs a guard for d4, the pinning square. In thinking about how to do this, don’t overlook pieces already trained on the needed square but blocked; for maybe the blockages can be removed. Here Black’s queen is pointed at d4. The rook on e4 would be out of the way after the exchange just discussed, leaving only the f4 pawn cluttering the line. How do we clear a pawn from its rank? Take something it protects—as with Nxg5. Put these points together and we have this sequence for Black: 1. …Nxg5; 2. f4xN, RxB; 3. QxR, Bd4 and now the queen is pinned by a bishop that enjoys protection from Black's queen.
There were other ways you could have tried to provide protection for d4, such as c7-c5. But that’s not a forcing move. When you are playing sequences that are meant to set up a pin, you want to operate with checks, captures, and threats that limit your opponent’s range of replies. In reply to c7-c5, for example, White just plays BxR and the pinning threat is extinguished. The beauty of Nxg5 for Black is that it not only takes a pawn but threatens White’s queen immediately and threatens serious trouble for White’s king (Nh3 would create lots of problems). So replying f4xN is hard to resist for White, and it achieves Black’s goal of getting White’s pawn off the fourth rank.