In recent months, NHL fans across North America and all over the world have complained that the NHL's hard salary cap is unfair for their own teams and the league in general, make notions that it penalizes success. Simply, a hard salary cap in professional sports does not allow a team's total cap hit to exceed a maximum number during the season. This creates many issues.
As teams become more successful, their improving players almost always command more in salary when they become free agents. In hockey, with a 23 man roster, there is only so much money that can go around to all of the players in order to be under the cap by the start of the regular season (for 2019-20, the cap's upper limit is set at $81.5 million). This means that teams are unable to re-sign unrestricted free agents or may have to trade existing roster players for cheaper players and/or draft picks as a form of cost control in order to keep their roster under the upper limit.
As mentioned before, fans are enraged that their favorite team(s) may have to trade or lose core players in free agency simply because of the team's position just below the upper limit. While from the surface they have a great point, there are many reasons why the NHL has a hard cap. In order to create a semblance of parity, the hard cap prevents big market, higher revenue-generating teams such as Toronto, Montreal, Boston, Chicago, and the New York Rangers from being able to spend "all the money" on free agents or new players via trade whereas small market, lower revenue-generating teams such as Carolina, Winnipeg, Florida, and Arizona are unable to pay their players what said players could make on the free market.
In a soft salary cap system, like the NBA or MLB, teams are allowed to spend as much as they want up to a threshold that differs for each league that penalizes them: a so-called luxury tax. In these systems, big market, super successful teams (or ones with extremely rich owners) spend an incredible amount to either keep their existing core of players together or add to it to create a perennial championship contender (like the Golden State Warriors have in recent years), while the smaller market teams are unable to do so as they generate less revenue or have stingy owners (like the 2015 Kansas City Royals, who lost expensive players in free agency in recent years). The NHL and NFL's hard cap system evens the playing field between big and small market/revenue teams generally speaking.
While in a mostly capitalist society it seems weird to penalize success, pro sports leagues generally have an interest in creating more interest, which can be done with greater parity of champions and championship contenders. In the case of the NBA, the Golden State Warriors dynasty boosted casual interest but turned off many in other markets who were tired of the same team winning, which was in major part done because of a soft cap system. While the NHL has had multiple time champions in recent years like the Chicago Blackhawks, LA Kings, and Pittsburgh Penguins, they were all able to adjust to their success within the system to win again.
The hard cap will never be perfect and will have its opponents forever, but ultimately, the system helps to level an unequal playing field from the beginning.