If I'm understanding the parent comment correctly, I don't think they mean not to be happy for others, but that being happy for others is worth it even if you choose to do it purely for selfish reasons. The benefits of cheering on others are worth it even if you ignore the effects that the cheering actually has on the person you're cheering for.
If you're asking why not have both motivations for it, I think that their suggestion is based on the assumption that some people might be struggling to do it for altruistic reasons if it doesn't seem like the people they're cheering deserve it. Even though it's somewhat counterintuitive to my, in my experience this is a pretty common way of thinking, especially when people feel like rewards they had to work hard for come easily for those who get them later. As a (partially made up) example, imagine if you obtained a degree where one of the requirements was a grueling, difficult course completely unrelated to anything you're trying to study, and the year after you graduate, the university finally recognizes that the requirement was unreasonable and removed it. Following the line of thinking from the article, the response that would be the most beneficial would be to be happy for those students who no longer have to take the course, but from what I've seen, it's at least as common for people to instead be upset about the unfairness of having to do the unnecessary work. For people who feel this way, I'd argue that the more compelling reason to try to feel happy rather than resentful isn't how it affects the students who get to avoid this extra work, but because the resentment doesn't really achieve anything other than making you feel bad. While it's not as easy as just "deciding" not to feel that way, I do think that we have the ability to influence our own mindsets in the long term, and I genuinely believe that actively leaning into the idea of celebrating the good thing happening for others each time a circumstance like this happens will eventually make it easier to let go of the resentment when it happens again in the future.