It is ironic that so many otherwise intelligent people find such a simple concept so confusing. A CEO, or janitor, or anyone else usually tries to get the best deal they can. The competition for the relatively few C level postition available is intense, and the resulting compensation can be astronomical. Think in terms of an NBA starter, or left handed pitcher.
Sometimes companies make a mistake, and hire the wrong person only to fire him later, and have to pay out millions. If I were a shareholder I would be irate, but otherwise, I don't care.
I really don't understand why people get upset over how much others get paid.