The statement above from Hamlet contains both an implied metaphor and a metonymy.
A metaphor is a comparison that does not use the words "like" or "as." For example, "Juliet is the sun," is a metaphor: Juliet is being compared to sun. We know it is Juliet who Romeo is speaking of because he tells us her name (I am paraphrasing, not quoting from the play). In an implied metaphor, the identity of one of the items being compared is unstated or assumed to be understood. For example, were Romeo, a few minutes later, to say "the sun has disappeared from the balcony," this would be an implied metaphor: we would know Romeo was talking about Juliet even though he hasn't said her name.
Therefore, when Hamlet learns of the "serpent that did sting," we know this is an implied metaphor comparing Claudius to a serpent without using the name Claudius. We know this "serpent" is Claudius because we also learn that this serpent wears the crown, and only one person wears the crown in Denmark.
A metonymy is when a part stands in for or represents a whole. A crown is a part of what makes a king a king—in fact, it is the identifying feature by which we know who the king is—so it is often used to symbolize a king. Obviously, crowns are not just floating around running countries but are a part of the kingly apparel. The crown (the part) is used to represent the monarch (the whole). Therefore, "now wears his crown" is a metonymy for Claudius being king.
"King Claudius murdered your father" means the same thing as the statement above, but it is a far less dramatic or nuanced way of speaking. We love—and are sometimes vexed with—Shakespeare because he was such a vivid wordsmith.