Gollum got his name from the curious noise he makes in his throat; his given name is Smeagol. Gollum or Smeagol stole the Ring from his cousin Deagol and murdered him. He justified taking the ring as his birthday present. It was his birthday, and so forth.
Years later, in The Hobbit, Gollum lost the Ring under the Mountain whereupon Bilbo promptly found it. After the famous Riddle Game, during which Gollum was unaware of his loss, Gollum refused to show Bilbo the promised way out and plotted to murder Bilbo, who managed to jump over Gollum to safety. Gollum cried out, "Thief! Baggins! We hates it forever!"
In the Lord of the Rings, Gollum reappears searching for the Ring and betrays the Fellowship to a band of Orcs. Following a battle, Frodo and Sam strike out on their own towards Mordor. Gollum follows them, but is eventually captured by them. Frodo forces Gollum to swear on the Ring itself, Gollum's "Precious", that he will not hurt Frodo, but rather will guide him Mordor. Gollum agrees. The unlikely threesome make their way into Mordor, but Gollum again tries to betray them at the border. Just as Frodo warned him, Gollum's betrayal of his oath to the Ring ultimately leads to his undoing.