As companies get bigger, the executives are able to add more value. If you have an executive leading the largest company,(i.e. Apple valuation wise), they have the largest ability to add value. And what is the supply for that? So far only one person, the current CEO, has experience. This creates a very limited supply where the pay matches the value created closer than in the vast majority of professions.
Apple made 94.68 billion while paying Tim Cook 98 million. They paid him 1/1000th of their profit. If Apple knew someone else could do 10% better than him, they would very gladly replace him and could even pay his replacement ten times more. Ten percent more of 94 billion would be 9.4 billion, while the replacement would make 1 billion.
I don't know if you are a software developer, but often they will look "up" at people making more than them and claim that they make too much, without looking around understanding that no company pays new grads $200k out of the kindness of their heart. The answer to why anyone makes as much as they do is simply because the market allows them to capture that much of the value they create. Emotions and comparisons are not relevant.
"In 2020, the ratio of CEO-to-typical-worker compensation was 351-to-1 under the realized measure of CEO pay; that is up from 307-to-1 in 2019 and a big increase from 21-to-1 in 1965 and 61-to-1 in 1989."[0]
[0]: https://www.epi.org/publication/ceo-pay-in-2020/