Because they are being offered huge piles of money
Pretty much it...when someone offers you in the $100M++ it's hard to say no, especially if you need the cash or are getting older and figure you are not likely to see anything close to that sum from royalties before you die.
This article also explains possible reason well
Why Superstar Artists Are Clamoring to Sell Their Music Rights
In the US, where a lot live, a tax window is closing soon so might as well cash in now and pay less taxes.
Consider Bob Dylan, who sold his publishing catalog for $400 million: At 20% tax, he’s due to pay $80 million to the government; at 37%, he’d need to turn over $65 million extra.
Personal circumstances
Two examples: Bob Dylan is nearly 80 years old, has had six children, and will surely be thinking about his estate planning. A lump of $400 million is far easier to divvy up than a lifetime’s patchwork of publishing copyrights.
Shakira, meanwhile, was
embroiled in a tax-evasion case in Spain in the past two years, with the local government accusing her of owing more than $16 million in back-taxes.
Gamble on getting more value now than what the rights might be worth over time.
Company is paying artists and songwriters an average multiple of “14.76x historic annual income” — i.e. 14.76 years’ worth of predicted royalty profits — for their catalogs. The bigger the superstar, the bigger the multiple: Universal is believed to have paid Bob Dylan a multiple in excess of 25-times what his song catalog banks each year.
Taking this money upfront rids artists’ lives of several unpalatable uncertainties.