I agree with the other two answers, but I feel like I also need to comment on the beginning of the game since there was A LOT more important stuff there than just the answer to why Qxg5.
This is very similar to a Kalashnikov Sicilian by transposition with the exception that the knight is on c3 instead of a pawn on e4, but the ideas are very similar. In particular, the moves Bb4, and Bxc3. The doubled pawns were not worth it, and I will go into why below. There are fairly extensive notes in the game below about the opening play.
[FEN ""]
1. d4 (1. e4 c5 2. Nf3 Nc6 3. d4 cxd4 4. Nxd4 e5 5. Nb5 d6 {This is a normal move order to get to the Kalashnikov Sicilian. Your game is not quite a Kalashnikov, but it is very close, and the strategic similarities are relevant. } (5... a6 {Or this. Ulf's favorite, leading to an endgame.})) 1... c5 2. Nf3 cxd4 3. Nxd4 Nc6 (3... d5 $1 {Take the center!}) 4. Nc3 e5 $2 {This is premature since the N is on c3 instead of e4 having been played. You also have to have a feel for how the hole on d5 needs to be managed. In general, you do not want to create a backwards pawn on an open file.} 5. Ndb5 {Nd5 is now a threat winning on c7.} Bb4 $2 {In similar structures in the Kalashnikov, the bishop never goes to b4, as you almost never want to take on c3. The doubled pawns are not worth it for reasons I will give below, but also because after e5, you have weakened the dark squares around your king. The game actually showed what happened when a knight got to d6.} (5... a6 $1 6. Nd6+ Bxd6 7. Qxd6 Qe7 {Is a main line that Ulf Anderssen plays with the difference being that the N is on c3, instead of e4 being played, so your options were limited to just a6.}) (5... d6 $4 6. Nd5 Qa5+ 7. Bd2 $18 {Is the simplest.} Qxb5 $4 8. Nc7+ Kd8 9. Nxb5) 6. Bg5 Bxc3+ $2 {In many similar positions, the Nc6 will come to d4 with strong threats, but here, giving up the bishop takes that off the table. At least, I would wait until white wastes a tempo with a3, forcing your decision. In addition, a Nd4 gums up any white counterattack down the d-file, and limits white's space.} (6...Qxg5 $19 {This is MUCH stronger here.} 7. Nc7+ Kd8 8. Nxa8 b6 {And black is way ahead in development, and more importantly, it is hard for white to finish development, and catch up.}) 7. bxc3 Qa5 $2 (7... Qxg5 {As you, and the others mentioned.}) 8. Qd5 Nge7 $4 9. Nd6+ {We see the dark squares have the final say due to bxc3 earlier.} Kf8 $2 10. Qxf7#