The origin of the Pygmalion story lies in ancient Greek myth. Ovid's Metamorphosis continued its fame (Ovid being one of the more important Classical writers in the English Renaissance). The Pygmalion myth has elements of male fantasy, as the sculptor creates a "perfect" woman after becoming disenchanted with real women (most notably prostitutes). The perfect woman, in this sense, is a beautiful creature with no artifices to challenge male security. Pygmalion remains frustrated that he cannot possess his Galatea statue as a woman utterly under his control, subject to his desire.
Elements of this art-becoming-life story can be found in Pinocchio as well as in Shakespeare's The Winter's Tale. In Othello, at the end of the play, Othello makes a reverse wish, wanting Desdemona to be an alabaster statue that he can love without fear of her disloyalty. In these stories, we find fodder for psychological interpretations of wish fulfillment and control.
When Shaw picks up the myth and its traditions, he offers a distinctly social satire. Higgins reforms Eliza through speech and demeanor, polishing her as a sculptor would his creation. The point is to show the excellence of his art. Eliza's own living self chafes at the uselessness of her training in a world that insists on class structure rather than personal ability. After some resistance regarding a less expected happy ending (Higgins and Eliza marrying), Shaw persists in the value of his own ending, where Eliza marries Freddie:
When Eliza emancipates herself—when Galatea comes to life—she must not relapse. She must retain her pride and triumph to the end. When Higgins takes your arm on 'consort battleship' you must instantly throw him off with implacable pride; and this is the note until the final 'Buy them yourself.' He will go out on the balcony to watch your departure; come back triumphantly into the room; exclaim 'Galatea!' (meaning that the statue has come to life at last); and—curtain. Thus he gets the last word; and you get it too (Letter from Shaw to actress playing Eliza, cited below, page 43).
Underscoring Eliza as a living Galatea who can take full independence from her creator, Shaw offers an inversion of Victorian sentimentality, which he stubbornly satirized.