Broken Hero

A hero who is a dropout, result of a failed experiment (in Sci Fi), or maybe just abandoned/abused as a child. Nonetheless, this character is amazingly cheerful and optimistic, and nice to even the people who don't appreciate him. May be introduced as a Big Eater, a ditz, or some other harmless personality. He may even make some ostensibly humorous jabs at himself.

Their Backstory is usually learned in flashbacks sometime later in a show, sometimes without warning. This can shock the other characters, especially The Rival Anti-Hero, and earns him new respect.

A Beta Test Baddie and a Broken Hero often have a complicated relationship of sympathy tied with dislike, until the former finally loses patience with the latter.

Anime & Manga

 * While he may not necessarily be the main hero of the story, Momiji Sohma of Fruits Basket is impeccably cheerful and caring despite having his mother rejecting him and eventually going insane due to Momiji's curse (turns into a rabbit when hugged by the opposite sex or very stressed like when sick).
 * Tohru, who is the main character, lost her father at a very young age, her mother in her teens, and ended up living in a tent. Nevertheless, she is cheerful and bright -- so much that other characters who want to help and provide moral support have to figure out on their own that she's in need of it.
 * Allen Walker of D.Gray-man. He's nice, cheerful, idealistic, and really, really cute, but his life has been kind of traumatic. By which we mean that his parents abandoned him,, his foster father died, his mentor abused him, and he has to watch tormented Akuma souls screaming in pain. He's one of the most Badass woobies ever.
 * And (in the anime) the very first Akuma he killed (besides Mana) was his best (and only) childhood friend.
 * Negi's father, Nagi, was one of these. A magic school dropout who only memorized about six spells yet was the Magnetic Hero of his group. Rakan is an even better example, but that edges into Obfuscating Stupidity.
 * And Negi himself despite only being ten. No parents, no family except a cousin that was away most of the year and then that whole bit where demons invaded his village and turned everyone to stone. Everyone was horrified to see his memories of said event, which worked exactly opposite to how it was supposed to.
 * Negi actually fills this role more than his old man does. A Broken Hero is someone who's had a traumatic past, but puts on a sheerful front. We haven't been shown anything to believe that Nagi's simply an Idiot Hero who's really optimistic.
 * Sousuke Sagara from Full Metal Panic!! is a borderline example -- he is normally The Stoic, but is a mentally well-adjusted and good-hearted person under it all, if somewhat socially awkward. For someone who has been a Mujahideen Child Soldier since the age of seven before moving on to work for a mercenary army and has literally never known normal civilian life, that's rather impressive. The sympathy this engenders for him from the school staff may explain in part why he always seems to get away with bringing guns to and detonating parts of the school building on a regular basis.
 * It also helps that Mithril bribed the hell out of his school when he first enrolled.
 * Vash the Stampede from the Anime Trigun.
 * Pretty much EVERYBODY in GetBackers.
 * Sanosuke Sagara from Rurouni Kenshin, a happy-go-lucky brawler and gambler who never met a jug of sake he didn't like; also estranged from his biological family and had his father figure executed on false charges by the very government they helped to bring into power. Kenshin himself qualifies as well.
 * Naruto, who is basically shunned by his entire hometown because of the demon sealed inside him. He is nevertheless cheerfully nice and compassionate to anyone he meets. His Foil, Gaara, is basically what Naruto would be without Squad Seven, the Hokage, and Iruka.
 * Nagato served as the example of the alternate outcome should Naruto have chosen to give in to his anger instead.
 * In Gundam Wing, Duo Maxwell's seemingly self-congratulatory "God of Death" (Shinigami) nickname takes on a new light when it's revealed that he took it on given the fact that anyone he cares about tends to die if they hang around him.
 * Done again with Sanders in 08th MS Team; he picked up the nickname given the unfortunate tendency of almost every unit he joined getting wiped out on their third mission together, except for Sanders himself.
 * Apollo from Sousei no Aquarion is a kind of Broken Hero.
 * Gon Freecs from Hunter X Hunter lost his mother, his father is missing, and he has a knack for making enemies who want to gut him, but is still eternally cheerful. He's the Broken Hero and The Ditz rolled up in one.
 * Judai Yuki from Yu-Gi-Oh! GX turns out to be one of these by season three.
 * Tsuzuki of Yami no Matsuei. He's a Big Eater, Badass Adorable Shinigami, who everyone seems to make jokes about, including himself. Until the Kyoto arc, that is.
 * Miroku from Inuyasha is an easygoing, carefree and cheerful guy who likes to joke and tease, even though he will die very young being consumed by the Wind Tunnel in his right hand.
 * Mami Tomoe from Puella Magi Madoka Magica, who smiles as she gives advice to Madoka and Sayaka and fights the Witches... but confesses that she cries a lot when alone and says her smiles are all false.

Comic Books

 * Pretty much everybody in the Marvel Universe. There's Captain America (comics) (grew up poor during the Great Depression, parents died when he was young, dead sidekick and identity issues), Luke Cage (grew up in a bad part of New York, wrongly jailed for drug possession), Iron Man (alcoholism, depression, self-worth issues, romantic issues and massive survivor's guilt), Deadpool (disfigured, partially reformed murderer, crazy), every single X-Man (Fantastic Racism), the Fantastic "I promise I'll make you normal again someday, Ben!" Four, a certain Dr. Bruce Banner, Rick "the Hulk is my fault and I'm often trapped in the Negative Zone" Jones, the seething mass of neurosis that is Spider-Man, everything that's wrong with Henry Pym, and... yeah, pretty much everybody else.
 * The Initiative in the Marvel Universe is a government subsidized effort to train the next generation of superheroes, which includes some old characters and new ones. Those that weren't already broken when they went into the program...are quickly and brutally broken down by the events in the Initiative series.

Literature

 * Neville Longbottom of the Harry Potter books eventually evolves into a Broken Hero after the tragic insanity of his parents is revealed to Harry.
 * As well as Harry himself - he's nice to people despite being emotionally abused by his aunt, uncle, and cousin.

Live Action TV

 * Chuck in Pushing Daisies is extremely upbeat and enthusiastic for someone who has never known her mother, had her father die when she was nine, the moved in with her aunts only to die herself and then be resurrected in such a way that she can't see them again either.
 * Stargate SG-1. All the characters have suffered tragedy to some extent, Jack lost his son, Sam lost her mother, Teal'c lost both parents, etc. But Daniel wins this trope for being more or less cheerful despite losing his parents as a child in an accident, losing his foster parents in another accident, spending most of his professional career having his theories scorned at (most of which, as he points out, turned out to be right) and had just been evicted from his apartment at the start of the movie. As soon as the TV series starts, his wife is taken. He spends five two and a half series trying to rescue her,  but is still polite, has faith in common humanity, and chides Jack on being so snarky.
 * Actually subverted on nearly all counts. Teal'c only lost his father, not his mother, and while Daniel certainly did lose his biological parents, his foster parents were never mentioned in canon. If he did lose them, too, we didn't hear about it. And his backstory was alluded to since the original Stargate movie, as was Jack's particular tragedy - Jack O'Neill having made his first appearance trying to commit suicide with a nuclear bomb. Daniel's being 'polite' is often strewn with pithy and/or patronizing comments, and his having faith in humanity could be considered gullibility. Jack's open hostility, sometimes snide cynicism and occasional moral pragmatism disqualify him completly, though in the trauma stakes he could probably trump Daniel. Teal'c has a similar problem to Jack, and Sam was never broken enough to qualify.
 * Dr. Gregory House, from House, MD. Minus the "nice" and "cheerful" bits.
 * Glitch, from the Tin Man miniseries, who is awfully upbeat for someone who's had half of his brain removed by the bad guys. Missing half his brain may be why he's "upbeat". The parts of him that could react appropriately are floating in a jar somewhere.
 * Both Sam and Dean from Supernatural, due to their crappy childhood and their status as Cosmic Playthings. Except that while they're nice guys, you could probably get frustrated with them very easily because of all those issues.
 * Even though his Backstory is revealed almost immediately in the pilot episode (or would have been if it hadn't been shown last...), Malcolm Reynolds of Firefly qualifies.
 * It should be noted, however, that Fox employed Executive Meddling after viewing the pilot to make him more of a jokester; his portrayal in the Pilot Movie was somewhat more low-key and bitter. But in all versions there's still an element of this depending on the circumstances and Mal's mood.
 * Ditto for River Tam; during her more lucid periods she's actually a really nice and cheery girl, but she is about as completely broken as a person can get, without factoring in her madness.

Video Games

 * Niko Bellic of Grand Theft Auto 4 once his full backstory is revealed.
 * Cloud Strife from Final Fantasy VII has more than a few elements of this -- he's a bullied-as-a-child People Jar escapee. He's got a dorkish, awkward side to his personality as a result.
 * Robo from Chrono Trigger, who was abandoned by its creator for sympathizing with the humans. He's also literally broken when he's introduced, needing Gadgeteer Genius Lucca to repair him before he can join the party.
 * Marona from Phantom Brave, possibly. Her parents died when she was five and the world as a whole, apart from her brother, seems to hate her for her spirit-seeing power, but she's The Messiah nonetheless.
 * It's worse than that. That 'brother' is really an Honorary Uncle. Who's also dead.
 * There's quite a bit of terror in realizing that this is a prepubescent child who's only real companions are dead people for the majority of the game. Ash is a dependable guy, but he's not exactly fit to do the bills and the vacuuming, meaning that Marona basically manages an entire island by herself.
 * Shirou in Fate/stay night. As his Backstory reveals, he lost his family, his friends, and his old life in the great fire 10 years ago, but is still extremely friendly and helpful towards almost everyone and never seems bothered by the event beyond some bad dreams. As one of the game paths later reveals, Shirou basically lost his entire existence and sense of self from the trauma as well, and his personality was 'rebuilt' around the fact that he was rescued when basically no one else was. Shirou is fundamentally broken on a mental level, in that he is unable to live for his own sake and can only find meaning in life through the act of saving others like he himself was once saved.
 * Lucius from Fire Emblem. He was brutally tormented in an orphanage after his parents died when he was three, yet he still treats everyone with compassion and fairness, even going so far as to say that he wished that the man that abused him could still live well.
 * If I'm thinking of the same character here he also forgives the man who murdered his parents, and caused his terrible childhood.
 * Well, technically the man he forgave had only killed his father, and his mother by proxy (she died later of grief and stress), but ... yes, Lucius is an absolute paragon of compassion (most people wouldn't forgive such a person, even though they felt remorse for their past sins, so Lucius definitely stands out).
 * Gulcasa of the Ancardia series of Dept. Heaven games. You don't see as much of his normal disposition in Yggdra Union due to his fighting for the opposite side, but in the other two games especially, he's revealed to be the sweetest, most idealistic and Adorkable demonic Christ figure you ever did see. His mother abandoned him when he was a toddler, his father brutally abused him all his life, and he grew up in extreme squalor. When his life finally started to turn around at age seventeen when he was a part of La Résistance, his father figure betrayed him, his childhood friend/surrogate mother/possibly first crush died because of it, he had to kill said father figure because of this, he was reunited with his mother only to be forced into a Duel to the Death with her, and then his other childhood friend and his mentor backstabbed and deserted him. The Trauma Conga Line made him a lot more driven, but didn't put much of a dent in his wholehearted love for and trust in his True Companions or his determination to create a peaceful world.
 * Commander Shepard of the Mass Effect series can fit this depending on you play Him/Her. Two of the back stories, Earthborn and Colonist has Shepard being an orphan, the former has Shepard being a product of the streets while the latter had Shepard's entire family killed.
 * Colonist Shepard can even admit to one character that s/he was totally broken for a while after his/her parents were killed and maybe still is.
 * Leanne of Resonance of Fate fame. Several times it's remarked how cute and sweet she is, and she is a perpetually upbeat, cheerful, determined and playful little thing. (At one point, a dorky, strange, not physically attractive possibly, uh, 'special' character hires her to go on a date with him as a job. At the end, she refuses the money and flirts honestly with him, saying 'It wouldn't be a date if I took that, now WOULD it?' With a wink and a sweet grin.) She's also totally girly, even when kicking ass and taking names in gun battles. Meanwhile, she's actually the only survivor out of twenty experimental children who were all supposed to die at set dates in an attempt to control the human lifespan. She is very aware of it, and, in fact, attempted to commit suicide immediately before her time was supposed to 'run out', so she would control her own fate. Only one person in her life cared for her, and she's not sure if he's even alive- the last she saw of him, he was being dragged away after setting her free, assuming she had only a year left to live. Perhaps not as tragic as some examples here, but it certainly counts.
 * Big loveable goofball Snow from FFXIII is an orphan. You never find out about his past, per sey, but there are moments where it's demonstrated just how much he really longs for the family he never had, and how devoted he is to his fiancee, slowly endearing him-uh, sort of- to Lightning.
 * Arguably, Vashyron, also from Resonance of Fate, fits this. He is often relied on for comic relief and comedic moments in the game, he is rarely very serious for long unless on a job, he seems to get along with pretty much everyone he comes across, he's a womanizer, protective, and a fun loving eccentric. He is another lone survivor, however, after his entire military squad was wiped out. By a lone little girl. Well, okay, so she only looked like a little girl. If you don't count the horns.  Two of them originally escaped the carnage, but after a rather heart wrenching sacrifice- only Vashyron was left standing.

Webcomics

 * MAG ISA -- Eman Cruz was abused by his parents and by bullies
 * of Emergency Exit.
 * Der Trihs of Schlock Mercenary gets revealed as one in his Day in The Limelight arc.
 * of Hanna Is Not a Boy's Name. It hasn't been revealed what happened, but it's heavily implied in Tessa's DA sketches that something went wrong.
 * Alexander Hamilton in The Dreamer certainly counts.

Web Original

 * The Nostalgia Critic has more than a few aspects of this, being sad and/or pathetic most of the time. But when he's happy, he manages to get excited for a lot of things... even if it does usually end up getting crushed.

Western Animation

 * Oddly enough, Optimus Prime of Transformers Animated. Once a promising recruit at the Autobot Academy, now the captain of a washed-out repair crew.
 * To a degree, every member of his crew qualifies, too. Except maybe Especially Ratchet. If not literally because of the little bit taken off his helmet/head crest thingy, then because of the events that led to him
 * Although not the hero, Iroh of Avatar: The Last Airbender embodies this trope rather well. Introduced as Zuko's happy-go-lucky crazy old uncle, it's later show that he was a badass general before  and his younger brother