Goody Two-Shoes is a poor orphan named Margery Meanwell who only has one shoe. When she's given two shoes she is so happy she tells everyone she meets. Her story is found in the 1765 nursery tale The History of Little Goody Two-Shoes. Read here about how goody got added to her name.
These days the phrase means that the person being called a "goody two shoes" is smug and above virtuous.