Any number of ways. He could have blown a bubble and it popped and fell out of his mouth onto his pants. He could have been wearing his pants over his head. He could have taken his gum out of his mouth and placed it on a chair and then sat on it.
I started working with PC’s when they first came out in the 70’s, selling/supporting software, and got a call from someone saying they needed to speak to Ms Dos. I said there was no one here by that name, and they said “Well, it says right here on the instructions that I need to have MS DOS before beginning to install!”
The hamster might as well be happy. If he escaped from the cage and ran outside he’d be eaten in short order.