this is a stalemate you should try to mate by having the queen touch the opponent king while simultaneously touching your king against the backrank next time
Question: How is this a checkmate by opponent??

It is not a win by white, it is a draw because of stalemate.
Here is the definition of stalemate:
https://support.chess.com/article/682-what-is-stalemate
Why did white win instead?
You mean the computer swindled you of your rightful win. That's not equivalent to the computer winning the game.
(The stalemated side does not win a game under the current rules)
This position is a Draw. This is due to a rule in chess known as "Stalemate".
Here, the king is not currently in check, but can not move anywhere because all the squares are occupied by the queen, and the king does not have any alternative moves since the only pawn he has on the board is blocked by yours.

Because neither the king or pawn can move anywhere and the other king isn't in check, that's a draw by stalemate.

Because neither the king or pawn can move anywhere and the other king isn't in check, that's a draw by stalemate.
The question was how and why white won.

Because neither the king or pawn can move anywhere and the other king isn't in check, that's a draw by stalemate.
The question was how and why white won.
white didn't actually win

Check out the drills - they have this situation so you can practice finishing with a queen. I've done this before - that's why I needed the practice!

For some reason, some people have got the idea to engage playing chess games without reading the rules first.
And then post that sort of thread instead of checking on the rules...
If the result of the game written on the screen is "draw by stalemate", and the guy reads it as "white wins by checkmate", then he has much more serious problems than just not knowing the rules.
I'm black pieces, COM is white pieces. The final move was my queen to g3, but resulted in the COM winning the game. I thought moving my queen to g3 trapped the white king and would win me the game. Why did white win instead?