In Nagg's "Character Analysis" we go into this in a bit more detail, but the point is that Hamm and Nagg are similar to each other in all sorts of ways. They are father and son, after all. Each wants to be the center of attention whenever he is on the stage. Both are narcissistic and both are childish. Both are needy: Nagg for his pap and Hamm for his painkiller. Both enjoy telling jokes and long stories, and they want the people around them to be amused and/or impressed by them.
Now, here are two important differences. First, Hamm is in power and Nagg is not. If Hamm is the monarch of the room, then Nagg is what Hamm will look like when he is deposed and someone else takes over. Second, Nagg has something that Hamm does not: a wife that he loves. Nagg and Nell's relationship is the most compassionate one in the play. We have to wonder what Hamm will look like alone, as the end of the play suggests he might be.