We first meet Hamm when Andy's playing with him in the opening scene of the movie. He's playing the part of the safe that Mr. Potato Head breaks into, which works rather nicely since Hamm is actually a piggy bank filled with coins. Good imagination, Andy.
Once the toys start walking around and talking, we find out that Hamm is a bit of a wise-cracker and that he and Mr. Potato Head seem to be thick as thieves. He not above starting a panic during Andy's birthday party—he mentions that they'll be "next month's garage sale fodder for sure."
He's definitely the one that supports Potato Head's campaign against Woody once Buzz falls out the window. We can't really blame him for that one though since Woody was acting like a jerk.
Like Mr. Potato Head, Hamm isn't really a villain. He certainly doesn't worship the ground Woody walks on, but he doesn't blindly hate Woody and want to destroy him either. And, in the end, Hamm isn't afraid to admit when he's wrong and welcome Woody back into the fold at Andy's new house.
Quick fun fact: Hamm is voiced by John Ratzenberger (who you might remember as Cliff Clavin on Cheers). Ratzenberger's voice has been in every single Pixar movie since this first one, which makes him Pixar's "lucky charm." (Source)