Shaw's play, as its title indicates, owes much to previous sources, mostly mythology. Pygmalion was a character in the tenth book of Ovid's Metamorphoses. A sculptor from Cyprus who did not enjoy the company of women, the man Pygmalion created an idealized female form out of ivory and then fell in love with the statue. He began to bring it presents as he would a lover, and he prayed to Aphrodite-the goddess of love-to meet a woman like his statue. Instead, Aphrodite brought his statue to life. Pygmalion named her Galatea, married her, and had a son named Paphos.
This myth differs from Shaw's interpretation in several regards. Most importantly, Eliza (as Galatea) was already a living person before Higgins (as Pygmalion) "created" her. Higgins certainly shapes Eliza's demeanor, her voice, and the way she looks, but he does not fashion her out of marble. Higgins gives Eliza a new human life in the the way that Aphrodite did, while it was Eliza's father who "created" Eliza's material reality. Moreover (and quite rightly), Eliza is indignant when Higgins claims that her success at winning his bet is his own. When she realizes that she no longer fits into any stratum of society, Eliza curses Higgins for "creating" her at all. The largest difference between the play and the myth is the ending. In Shaw's play, the stand-in for Galatea does not choose to marry the stand-in for Pygmalion. In the prologue, Shaw explains that "Galatea never does quite like Pygmalion: His relation to her is too god-like to be altogether agreeable." In ancient myth, it was not so bad to have a relationship with a god, but this is not the kind of thing Eliza wants.
Shaw's Pygmalion has one other major source, the tale of King Cophetua. King Cophetua was an apocryphal monarch who was not interested in women until he met a beggar-woman. He fell in love with her and elevated her to be his queen. The Cophetua complex names an attraction to lower-class women, a tendency which Higgins exhibits in his interactions with Eliza. (The broader rags-to-riches theme is common in Western literature; compare the film Pretty Woman.) Higgins assures Pickering that his students are "sacred," because he has always found them so before. But he finds himself attracted to Eliza, who is quite different from the millionaires he taught before. Part of this difference is in the power dynamic which is so central to Higgins' relationship to Eliza. Like Pygmalion and King Cophetua, if he were to choose Eliza as his consort, he would be in a position of great power in the relationship.