Mary Sue

Mary Sue is a fictional character from fan fiction who is written to not have any flaws to the point where other characters love them but the audience hates them.
Paula Smith.
In 1973, a woman named Paula Smith ran a magazine that published Star Trek fan fiction and most people who wrote for the magazine were women. Smith complained that a lot of them liked to imagine themselves as being in the story, so they would write about Captain James T. Kirk and Mister Spock loving the female protagonist. Smith wrote the short story, A Trekkie’s Tale, in 1974 as a parody of Star Trek fan fiction. In the short story, Mary Sue becomes a lieutenant in Starfleet at fifteen and a half, Captain Kirk falls in love with her, and he makes her the new captain. Spock says this is logical and Doctor Leonard McCoy thinks she is a better leader than Kirk was. Mary Sue dies to save the Universe and is declared the greatest hero ever to exist. 
Fan Fiction.
After Paula Smith wrote A Trekkie’s Tale in 1974, people started to criticize Star Trek fan fiction. By the 1980s, people started to say that as a criticism of fan fiction for other franchises like Star Wars but at the time, the name “Mary Sue” was only ever used for fan fiction characters.
Wesley Crusher.
In 1987, Gene Roddenberry, whose middle name was Wesley, created a show called and said that his favorite character in it was Wesley Crusher. People who criticized the show often said Wesley Crusher was a Mary Sue. 
Star Wars.
Anakin Skywalker in The Phantom Menace was sometimes said to be a Mary Sue. And since then, there’s been debate about if Rey (Star Wars) were a Mary Sue, some saying she was and some saying she wasn’t.