This is an example of personification. Hamlet is angry that his mother has married his uncle so quickly after his father's death (he doesn't know at this point that Claudius actually murdered his father) and he blames it on his mother's weakness, which he attributes to women in general. By giving human characteristics to an abstract idea, Hamlet personifies it.
This line is also an example of a figure of speech known as apostrophe, in which the speaker addresses an abstract idea as if it were a person. In this quote, Hamlet addresses himself to "frailty," a concept.
In "frailty, thy name is woman," Shakespeare uses apostrophe, which means speaking to either an abstract concept or imaginary character as if it were real. Here, Hamlet addresses "frailty" or weakness as if it were a person. He also personifies it. When you personify a term, you give it one or more human characteristics. Here, Hamlet calls frailty a "woman." Beyond this, Shakespeare uses the technique of generalization to tell us something about Hamlet's attitude toward women. Although Hamlet is thinking particularly of his mother, who has remarried within a month of her husband's death, he doesn't say, "Frailty, thy name is Gertrude." No, he extends this idea of one woman's weakness to cover all women. We could call this stereotyping, in this case, sexual stereotyping. It doesn't necessarily follow that because his mother is weak, all women are weak or that her weakness derives from her gender. This brings us to anachronism: Shakespeare is not trying to be anachronistic in putting this utterance in Hamlet's mouth, but we need to keep in mind that attitudes have changed in the centuries since he wrote his play.