In Anatolia Story, Yuri and her friends help a group of peasants in Egypt organize into a proper rebellion, with the intended end goal of getting Ramses released from prison so that he can set off on his goal of taking power and making life better for the lower class. Most unfortunately, she forgets to actually tell this part to the rebels. Thus, the leader is more than a little annoyed when he sees her sneaking off in the middle of the incited riot, thinking that she never actually cared about their cause and was abandoning them when things were tough. He swears vengeance on her and joins the next battle specifically for a chance to kill her.
A rare villainous example: While searching for Eren, the Female Titan kills the Survey Corps members who try to fight her. Mysteriously, however, she spares Armin... who realizes that she is The Mole and later figures out that she is, in fact, fellow graduate of the 104th Trainee Corps, Annie Leonhart.
Goes on even further in the Manga, when Eren and many others discover that two more members of the 104th Trainees are powerful Titans determined to kidnap him. He lampshades the trope while fighting them as a Titan, by saying that their biggest mistake was teaching him how to fight.
A few in Battle Royale, but most notably Yuichiro. He was the only person who ever had any faith in Mitsuko and tried to reach her at all (which actually did succeed), and what happened in the manga version? She raped him after he was shot, in a crazed attempt to "make it better," before stabbing him to death with her kama. Not only that, he was shot with his own gun, which he had traded to a friend as a sign of good faith. Note that the above happens only in the manga, and while Mitsuko does kill him in the movie, the novel and the manga, the events differ slightly in all three.
This is pretty much the punishment for being a good person in the Berserk universe.
Accelerator suffers brain damage via a bullet to the head the first time he uses his powers to save rather than hurt someone. And he continues to get hit with this again and again as the story goes on, although he eventually begins to see some benefit from it as he adjusts his worldview.
Not to mention Touma himself, who almost always winds up in the hospital after helping someone. His first attempt at helping someone? Lost his memories.
In Claymore, Teresa saves her dear Clare as well as an entire village from being raped, pillaged, and burned by a bunch of bandits, and got marked for death as a reward since the Lawful Stupid Organization forbids Claymores from killing humans, no matter the situation. Worse in that the village being attacked was her fault, since she'd intended to leave Clare there so she could live in peace and killed the yoma who had been there first. However, the presence of yoma in the village was what was keeping the bandits at bay, so killing the yoma meant giving a gateway for the bandits to begin their operation.
Even more sad was when Teresa saves another town from a yoma without being paid the hefty fee that the Organization asks for as payment (since she was on the run), but said it felt nice to do something good without being paid. Moments later, an execution party came to take her head.
The most egregious example: Lelouch decides not to go through with his plan to make it look like Euphemia plotted to assassinate him, which would've given Japan justification for a full-scale revolution. Instead, he decides to accept the third option that would allow everyone to get what they want without any bloodshed, even though it means he'll lose his chance at revenge. Oops, we can't have that! Instead, his Mind ControlMagical Eye goes out of control at the worst possible time and he accidentally forces the most innocent and idealistic character in the show to massacre the people she was trying to help, sparking the revolution anyway, though it eventually fails and everyone is effectively back at square one.
Lelouch's desire to protect his sister can also be viewed as a character flaw. He often endangers his men by putting his sister, one person, before the good of everyone else in Japan.
If he killed or enslaved Suzaku when he had the chance, he'd be that much more powerful.
Had he not also spared Villetta in the second episode, he could have avoided many, many problems.
Digimon Tamers: Leomon attempts to stop Beelzemon from harming the Tamers anymore. Beelzemon promptly turns around and stabs him, kills him, and "eats him". This leads to Jeri's Despair Event Horizon and the D-Reaper's invasion.
This happens to Beelzemon himself when he attempts to atone for the above scene by saving Jeri from the D-Reaper; he has his help thrown back in his face and gets rather violently shot multiple times.
In the 13th Dragon Ball Z movie, Gohan and Videl as The Great Saiyaman and Saiyawoman end up saving Hoi from committing suicide by jumping off a building. Turns out Hoi was a terrible man who wanted to revive a demon and was the survivor of an equally evil race of extraterrestrial wizards, and intended to feed Earth to it.
In ERASED, protagonist Satoru Fujinuma experiences a phenomenon he calls "revival," where he's forced to intervene in disasters about to happen around him by getting trapped in a time loop until he averts said disaster. He complains that getting involved always has negative consequences for him but still does anyway. The first time we see him do this in the series, he's hit by a car trying to save a little boy from the same fate. The third time, he unwittingly foils a kidnapping, and his mother is murdered as a result while he's set up to take the fall.
Machi was afraid her baby brother was cold and went to put a blanket on him. Her parents accused her of trying to kill him and forced her out of home.
Kyoko is beaten to the point of hospitalization, loses her chance to get into high school, and gets disowned by her parents after trying to straighten out her life and leave the gang she was in.
When he was much younger, Kureno was actually freed from the zodiac curse. He agreed to pretend he was still a part of the Zodiac and stay by Akito's side at all times though, because he didn't want to abandon the poor kid. It's implied in present times that it would have been better for Akito's overall mental health if Kureno had instead broken away then and there, instead of feeding Akito's clingy dependency issues. When Kureno tries to make it better and gives Akito a very heartfelt talk about how it is better to live moving forward, Akito fully breaks down and stabs the poor guy in the back. Literally.
In Fullmetal Alchemist, Winry's parents, two medics that worked to save the lives of several injured Ishvalans in the genocide, were killed by Scar, after bandaging him up and treating his wounds. When Winry finds out, she immediately loses it.
Also, when Armstrong finds two Ishvalan women and try to allow them a way to escape, they don't get far before they are incinerated by Kimblee right in front of him, although Kimblee claims he's doing this because he respects Armstrong's convictions and doesn't want to see him court-martialed. This sends him into a massiveHeroic B.S.O.D..
When a young Temdan was about to be killed by a monster, a young Tegu used his celestial power to save him. Temdan thanks him, but his previously unknown disease begins to take its toll on him. Since Tegu is revealed to be a celestial warrior, a sign of ruin for the kingdom, he gets immediately imprisoned.
Tomite pays the ultimate price. During the summoning ceremony for Genbu, Tomite sees an injured person and rushes over to help them get to safety from the falling hail. The person is Shigi, who uses Tomite's good nature to have him let his guard down, and promptly kills Tomite.
Valiant efforts and good intentions don't usually turn out so well for people in Gantz. The series starts off with two of the main characters (one of them against his will) helping a drunk homeless man who had stumbled onto the subway tracks. They manage to get him onto the platform, and are subsequently hit by a train.
The main plot of InuYasha got started when Kikyo decided to be nice and take care of a paralyzed bandit. The universe's reward for her kindness: She gets to slowly bleed to death, thinking that her first love, who is also the first person to ever treat her like a human woman, had decieved her from the start and killed her in cold blood. And that was only the beginning...
Everything bad that happens in JoJo's Bizarre Adventure started when George Joestar I, out of the goodness of his heart, adopted an orphan boy named Dio Brando.
Eventually, Dio was killed by Jotaro Kujo to save Jotaro's mother from dying, but even that would eventually lead to Pucci, Dio's best friend, killing Jotaro in revenge, along with his daughter Jolyne and almost all of Jolyne's friends.
This happens frequently to the title character of Kaiji, almost to the point of being the theme of the show.
His situation starts with him cosigning on a loan for a friend. Months later, this turns out to be a loan from the Yakuza, who show up on Kaiji's doorstep to collect on the loan when said friend disappears. (Funnily enough, he trashes a nice car out of frustration just before this. It turns out to be a yakuza car... and he suffers no punishment at all.)
He gets an offer to go onto a ship and gamble for one night for a chance to clear this debt. After getting scammed multiple times in multiple ways, he decides to team up with his friend (who apparently didn't disappear after all...) and another man down on his luck to give him a better chance of winning the gamble. Early on, he meets the conditions to leave the ship with his debt cleared, but he refuses to leave until he's helped his two team members do the same. By the end of the allowed time for the gamble, he gets the other two to meet the conditions while losing his own advantage and being taken as a slave—however, with the extra those two got, they can "buy" him back immediately after and all three will be allowed to leave. They keep the money and leave him to be taken away to work off his debt as a slave.
He convinces someone else to "buy" him back and then takes back the extra cash his friends were trying to keep. He then uses this cash to "buy" back another scam victim out of sympathy. It turns out that this arrangement has a few strings attached, sending him into even greater debt than before.
He's later abducted by the yakuza again and presented with a race for enough money to cover his new debt three times over. He only gets this money if he finishes first or second. The race is a footrace across a thin iron bar. With a potentially fatal and definitely very painful elevation. There are three times as many contestants as iron bars. Pushing other contestants down is not only allowed, but encouraged, and there's one guy in front of him. The one guy in front of him is slow as hell, but he refuses to push. The guy behind him catches up and isn't so nice... Luckily, he manages to grab the bar and pull himself back up, being disqualified but not injured.
For another chance to get prize money (and for the winners of the previous "race" to collect theirs), it turns out that they have to walk, though not race, across another iron bar, this time with a dropping distance of several dozen stories and an extremely powerful electric current running through it. When the ten people who have decided to cross are all around the halfway point, he decides to get them to all forfeit the money so they can have the current cut and safely crawl back to safer ground. The power isn't cut... and everyone except Kaiji falls and dies. And then when he makes it, he finds out they were all disqualified because of him asking anyway, and he doesn't receive the prize money he just nearly died over.
In Macross Frontier, super popular Idol Singer Sheryl Nome, befriends a young girl Ranka Lee, who also wants to become a singer, and encourages her to do so, including offering a co-place at her show. Not long after that, Ranka becomes the new celebrity, and Sheryl finds herself forgotten and deserted by both her fans and her agent. Her CDs land in bargain bin, and her posters are thrown into rubbish to make place for Ranka's. Then it gets subverted as Ranka saves Sheryl from her illness and helps her defeat saidagent. Oh, and Sheryl regains her popularity too...
And it seems that in the movie it gets harsher. While Sheryl's fall wasn't in the first movie, she is also set up to be ruined financially, having paid for rescue operation of Galaxy. And then Sheryl's "reward" for paying for rescue operation is being sentenced to death.
In the manga version of Mai Hime, Yuuichi intervenes to save Shiho from some thugs who were planning on sexually assaulting her, but he gets injured in the process, essentially forcing him to give up kendo. As a result of his action, the entire kendo team is disqualified, and they take out their anger on him, forcing him to leave his school and come to Fuuka Academy.
The manga version of Mai-Otome has an incident in which Arika accidentally upsets Nagi, archduke of Artai, who orders her killed for it, until Nina offers to take her punishment. Nagi then whips Nina's backside with a riding crop and starts whipping her harder when seeing the bandages she put on when she pricked her fingers while desperately trying to finish her sewing project. Mashiro (or rather, the boy pretending to be Mashiro) then punches Nagi, and everyone gives him a What the Hell, Hero? speech for almost causing an international incident.
In Mobile Suit Gundam ZZ, the noble Hero Antagonist Arrow Mellow of the Blue Team turns on his own allies and shoots them down when he sees them targeting someone who appears to be a civilian fleeing from the fight. Unfortunately, that "civilian" is actually the pilot of the ZZ Gundam, and when Judau gets into his mobile suit, Arrow is killed in battle.
Monster is all about this trope. Dr. Tenma saves the life of a young boy, who turns out to be the titular monster, and spends the rest of the series paying for it. He also has a habit of risking capture to tend to others' wounds, even when he knows they're bad guys, and he eventually gets caught by the police because he stopped to help a little kid who scraped his knee. Poor Tenma.
The reason Nagato finally snapped and became Pain. Well, that and a bit of more general Cosmic Plaything status and a dead best friend (whose corpse he preserved and rigged up as a zombie avatar of himself).
Kakashi's father chose to give saving his captured friends priority over completing a mission, and as a result, was ostracized in the village- even by thosehe had saved- and ended up taking his own life. Kakashi took the inherent lesson to heart, suppressing his emotions and placing the mission above all else, and it took Obito telling him that he considered his father a hero, and going off to save Rin for Kakashi to change his mind and aid in Rin's rescue.
Kakashi abandoned the mission to save Obito after being called out on his actions. Unfortunately Obito ended up becoming the Big BadTobi and ended up being responsible for all the problems that happened in the ninja world.
God, Tsuna from Katekyo Hitman Reborn! is a very good kid. But it seems that whenever he ends up doing good or something morally right, he ends up paying for it. Sometimes literally. He saved a rare raccoon-panda thing from being rolled over by a roller coaster, but then the zoo fined him for breaking a few things in the process. He also caught a few infamous crooks, but the police arrested him too for looking like he was one of them, (he was in his boxers).
On a more serious note, he almost paid a greater price when Mukuro feigned a give-up and asked Tsuna to kill him. But Tsuna, invoking the Thou Shalt Not Kill trope, declined. Mukuro proceeded to grab him from behind, whispered why he fails at life into his ear- accompanied by a nasty headbutt- and then throws him in the direction of a nasty, pointed object.
This also turns out to be an Enforced Trope in the setting because the universe wants him to be a mafia boss, and even with the number of superpowers floating around the setting, it is logistically difficult to do this and be a morally upstanding young man. At least the main thing it actually requires him to do is to get into high-stakes superpowered battles with other mafiosi.
In Okane Ga Nai, Ayase kindly help a hurt and soaked Kanou, giving him shelter and words of comfort. Four years later, he gets owned (literally) by the very same Kanou, who begins the renewal of their relationship by raping him and subsequently taking control of every aspect of his life. This is not played quite positively, but it's not played entirely negatively, either. Presumably because it (and Ayase's incredible level of pathetic) are supposed to be titillating, since it is hentai.
One Piece: This seems to be one of the reasons why the Straw Hats are wanted. Every good thing they do (beating up other pirates or sadistic assassins) simply makes them look like a bigger threat in the eyes of the World Government and Marines. Though the corrupt marine Nezumi does cause Luffy to get his first bounty, it should be noted that Luffy's deeds were considered to be "undermining the worth of Marine forces" back in the East Blue Saga.
Though it's arguable as to whether this qualifies as punishment, considering bounties are usually considered a symbol of pride in the One Piece world, and the Straw Hats (with a couple exceptions) think it's downright awesome when theirs go up.
When Luffy met Zoro, the latter had been starving for nine days and was awaiting execution. The reason Zoro was arrested in the first place? While passing through the Marine Base town, he saved a little girl from being attacked by a vicious dog, whose owner (the son of the Marine leader of the town) promptly threatened to have the girl and her mom executed unless Zoro allowed himself to be arrested.
Sanji gives food to Gin, a starving pirate, who later comes back with the rest of the Krieg pirates, as Krieg wants to steal the Baratie. Possibly subverted when Gin is unable to bring himself to finish off Sanji. Sanji even gives food to Krieg himself, who promptly attacks him once he's eaten his fill.
In a flashback, the fishman Fisher Tiger took in a little ex-slave girl named Koala, and brought her back home. Koala's hometown sold Tiger's location out to the Marines (unbeknownst to Koala herself), and Tiger was consequently mortally wounded in the fight that ensued.
In the Dressrosa arc, the Living Toy Thunder Soldier is branded as a criminal because he stepped in a human's house in the process of saving his kidnapped surrogate daughter Rebecca.
Most of the wishes do this, but the first and most memetic instance is mundane: Madoka agrees to be Mami's friend, and fight with her so that she won't be lonely. Mami's so happy about this that she doesn't pay attention in her next fight and gets decapitated.
UQ Holder! reveals that Evangeline McDowell's history as The Dreaded started when she saved a town from some wizards. That earned her quite a few enemies who tried to kill her. With every one she killed in self-defense, more and more swore vengeance until everyone was afraid of and hated her.
In YuYu Hakusho, Yusuke is a teen delinquent, always in trouble, being told he'll never amount to anything (and starting to believe it). One day, he sees a little boy chasing a ball into the street, and rushes out to stop him without a second thought. He gets killed as a result. The worst part is if Yusuke had not pushed the kid out of the way, the kid would have been perfectly fine. Because Yusuke 'saved' him, he got some scrapes. Though eventually dying turns out to be the best thing that ever happened to Yusuke, since he gets better.
After everything he does in the series—a good half of it actively in pursuit of saving the day, and a majority of it within reasonable moral guidelines—he then gets killed again by the vastly more powerful villain. That isn't this trope; he totally earned getting killed by Sensui after Tempting Fatenote by demanding that Shinobu, his 'most powerful side' come out and fight after having had his ass handed to him by 'Minoru, the orator' and 'Katsuya, I do the sick work' and then rising above them. What is this trope is that his bosses then work out that he's got the genetic potential to turn into an atavistic super-demon, and send a strike team to obliterate his corpse. Again, he gets better.
In Zetman, the entire chain of events which is the main premise of the story, triggers by Jin trying to rescue a suicidal man.