Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Because after Bxf6 gxf6 there is Qxf6, which wins a pawn, threatens the rook and threatens mate on f7. You can castle, but then the king is exposed by the missing g pawn. Your only other option is Rf8.