An archetype is a pattern or type that occurs over and over again in literature. Shaw's Pygmalion derives from the Galatea story recounted in Ovid's Metamorphoses, and contains similar archetypes.
In Ovid's tale, the sculptor Pygmalion creates a beautiful statue of a woman. He falls in love with it and prays to Venus, the goddess of love, that it be turned into a woman. Venus grants his request and the statue becomes the human Galatea, who falls in love with her creator.
In Shaw's play, the linguist Henry Higgins "sculpts" the lower class Eliza Doolittle into a lady, mostly by changing how she speaks, but also by teaching her the manners and bearing of an upper-class woman. He succeeds in passing her off to the highest echelons of society as a someone born to their class.
Both tales use the archetype of the Creator: in Ovid, Pygmalion creates a statue that comes to life and in Shaw's play, Henry Higgins "creates" an upper-class woman out of the raw material of a flower seller. Both stories also represent the Transformation archetype, a common motif in literature. In both stories an important transformation takes place: a statue is transformed into a woman in one and in the other a lower class woman is transformed into a lady.
Shaw used the Galatea story because it would provide a recognizable frame to audiences of his time period, but more importantly, to underscore how much Higgins thinks of Eliza not as a person but as a "thing" that he can mold at his will. She might as well be a statue to him. This can be seen throughout the play in his rude and dismissive treatment of her. Shaw also uses the Galatea analogy in order to disrupt it: Eliza's transformation into something "fully human" comes not when she becomes a lady, but when she is able to assert her own self-worth by standing up to Higgins. Rather than show the fully human, transformed Eliza falling in love with her creator, Shaw shows that when she comes into her humanity, Eliza walks away from Higgins. Shaw thus uses the archetypes he does to create a commentary about gender: a woman who becomes fully her own person is not necessarily going to fall into the arms of her creator, though in another ironic twist, Shaw shows that by becoming a lady, Eliza is left with little option (if she follows gender norms) but to find a husband--though it doesn't have to be Higgins.