Everyone is supposed to cheer for good guys, and we should only punish the bad guys. But that's not what we always do. Most of the time, we do indeed reward good people. We also often punish people who harm others, or who aren't good team players. But sometimes, the good guys also get punished or criticized, specifically because they are so good.
This seems baffling, because it's detrimental to group cooperation. However, the phenomenon has been discovered in multiple fields, and it has been found in every society. Why does this happen? Research suggests a simple reason. When one person looks really good, others look bad by comparison. Those others then have an incentive in stopping that person from looking good, especially if they can't or won't compete. After all, we're all judged in comparison with others.
When faced with someone better, what can a normal person do? One option is to actively compete. A second option is to bring that person down; that is, to suppress their cooperation or work ethic, infer selfish motives for their actions, or imply real or imagined hypocrisy. Other tactics include attacking them on unrelated dimensions, or punishing them outright.
Why does this matter? Critics often attack the motives of people who protect the environment, donate money, or work too hard. Such good deeds are dismissed as naive or hypocritical by those who do not perform those deeds. This criticism may ultimately discourage people from doing good deeds. So it's important to recognize these attacks for what they are.