Maybe it preferred Bg5, which defended the knight and developed your bishop? There would be no easy way to remove the knight unless black wanted to trade a rook for knight and bishop.
Edit: disregard this comment. I had forgotten there’s a pawn on f7.
The game review says that grabbing a pawn with a trapped night is a mistake (trapped as part of an even material exchange) - I should have just developed the bishop instead. So are there any guidelines as to when to take material and when to develop? (in the game I played Bf4 after black had played Kxf7 - at this point, one move later, Bf4 was also noted as a mistake). Thanks.