I think that each party to the contract is obliged to fulfill it or pay a penalty for breaking it. When a player signs a long-term contract, he knows what he is getting into and receives a high salary and various bonuses. And in general, a contract is signed by two informed parties, it is not a "pig in a poke", if you signed it, you must fulfill it. The situation with Gyokeres and Osimhen is different, Gyokeres himself initiates his departure and does not want to fulfill the contract, Osimhen had no problems staying at the club.
According to Gyokeres's agent, the management had an agree with Gyokeres last season that would allow him leave the club this season for a certain fee but they're now going back on their words and demanding a very huge figure and claiming that Gyokeres is worth more than the initial figure they agreed, on the other hands Gyokeres wants to leave but the figures that sporting is demanding is chasing potential buyers from signing him, although the management of sporting has denied that their was no agreement and the player won't be sold for something cheaper than what they're currently demanding for, the situation is just so complicated and Gyokeres is left with no option but to try force his way out of the team, that's completely different from Osimhen's situation at Napoli.