I'm not very informed about chess rules but wasn't I suppose to capture his queen with my king?
That would be an illegal move. If you took the queen, then the pawn would still be attacking the g3 square (even though the pawn is pinned), and the King cannot move to a square which is being attacked.
You can also think of it this way: his pawn would capture your king BEFORE your queen could take the White King. Therefore, he would win first.
I'm not very informed about chess rules but wasn't black suppose to capture his queen with the king?