We know from the Hobbit that Gollum occasionally left his dark pool, wearing the ring, so that he could sneak up on orcs (called "goblins" in my copy) and kill them to eat.
As I recall, early in the scene he's beating the goblin and it fell from his loincloth / pouch. Not the same way as the book, but true to the notion that the ring has a will of its own, and seized / created an opportunity to change hands.
In the book, I think it's more implied than explained:
"""Gollum used to wear it at first, till it tired him; and then he kept it in
a pouch next his skin, till it galled him; and now usually he hid it in a hole
in the rock on his island, and was always going back to look at it. And still
sometimes he put it on, when he could not bear to be parted from it any
longer, or when he was very, very, hungry, and tired of fish. Then he
would creep along dark passages looking for stray goblins. He might even
venture into places where the torches were lit and made his eyes blink
and smart; for he would be safe. Oh yes, quite safe. No one would see
him, no one would notice him, till he had his fingers on their throat. Only
a few hours ago he had worn it, and caught a small goblin-imp. How it
squeaked! He still had a bone or two left to gnaw, but he wanted something
In early versions, he was more of a fairy tale creature and actually gifted it as promised, a magic ring.
Regarding orcs / goblins - as it stands, they're the same creature (I vaguely recall noting hobbit's loose tribes always referred to as goblins, compared to lotr's orcs & uruk subordinates, but that's unrelated to canon), though in various points during the writing there are hints they had been designated separate ones.