A goody two-shoes is someone who is viewed as cloyingly virtuous, self-righteous, or prudish. You may also hear a goody two-shoes referred to as a “goody goody,” a slang term with origins linked to those of “goody two-shoes.” This particular English idiom has a rather long history, with a number of twists and turns.
The term comes from a children's book, The Story of Little Goody Two-Shoes published anonymously in 1765. The book, which was wildly popular at the time, is about a poor child who goes around wearing one shoe. A gentleman gives her a new pair of shoes, and she runs about the community saying “two shoes, two shoes!” When the little girl grows up, she becomes a teacher, and eventually marries a wealthy man. The implication of the story was that although she suffered as a child, she was virtuous, so she was ultimately rewarded. “Goody,” incidentally, is short for “Goodwife,” a common term of polite address for women in the lower classes at the time.
Almost immediately, English speakers started using the phrase to describe particularly virtuous people, especially young children, although the term could be used to describe someone of any age. However, the term also had a subtle edge; the girl in the story seems a bit foolish and fatuous, so the slang term was also meant to suggest that someone was irritating, cloying, or not very bright, in addition to being virtuous.
Over time, the meaning of the phrase twisted even more. In the modern usage, people usually use the term to refer to someone who is viewed as insincere. To be called by this name is to be accused, essentially, of faking it, and the term is associated with people who are pretending to be virtuous or good in order to obtain something. Therefore, a child who attempts to be friendly with the teacher in the classroom in order to receive praise might be called a goody two-shoes on the playground.
This idiom also spawned an offshoot, “goody goody,” which means much the same thing as “goody two-shoes.” The shift from a positive connotation to a negative one is actually not all that unusual in the world of English idioms. As social values change and people forget the origins of idioms, their meanings may become reversed from the original.