White has the makings of a discovered attack on the g-file, of course, where his rook and bishop are in the standard formation. White looks for a violent, time-consuming move he can make with the g2 bishop and finds—nothing. BxB is met by QxB with no gain; Bf3 just loses the bishop. Still, a discovered attack pattern with a rook aimed at the enemy queen is an important opportunity, so White looks for other moves he could make that would create a target for the g2 bishop. It would be ideal if the bishop could check Black’s king. Where would it need to go to do that? To d5. What stands in the way? Black’s bishop at e4. That bishop cannot be captured, but it can be threatened with Qc2, Qd3, Qd4, or Qd5. Qd5+ is most interesting because it checks Black’s king and so requires immediate attention. Black would have to either move the king or take White’s queen. If he moves the king, White plays QxB (and if Black then plays QxQ, White has BxQ). So Black will play BxQ. Reconsider the board as it then would appear: the same potential for a discovered attack would exist, and now the White bishop’s path to d5 would not be blocked by Black’s bishop; Black’s bishop would be on d5. So White plays BxB+, and Black replies Kh8; and now White has RxQ. He has exchanged queens and won a bishop.
You might also have considered starting with Qd4. It looks safer because it doesn’t expose your queen to capture by Black’s bishop, but still attacks the bishop a second time; and it creates the threat of mate with Qxg7. But Qd4 has the major disadvantage of not giving check. A key difference between giving check and creating a mate threat is that a mate threat doesn't force such a narrow range of replies on your opponent. He may be able to address it by giving a check of his own that seizes the initiative. In this case Black can respond to Qd4 with Rxa2+. White has to reply KxR—and then comes another check from Black: Ra8. Since White has nowhere safe to move his king, he has to interpose his queen on a7 and lose it next move to RxQ. Then White has the recapture BxR, but that wasn’t exactly what he had in mind at the outset. Remember: if you resort to threats that don’t give check, you have to consider any checks (and any successions of checks) your opponent might be able to use to interrupt your plans.