Threy are paid wages like everybody else. And a CEO of a fortune 500 company will have special skills that nobody else has. The skills can be learnt mostly. But at companies this big, a CEO is an asset, a good CEO that can provide more growth and profit than anyone else will command a salary, and the market forces ensure that the salary they earn is inline with how much value they bring to the company.
And these people still pay tax, and a lot of it. It’s not possible to argue that a CEO is overpaid because CEO pay at this level is defined by the Market.