Cook, who has led Apple since 2011, will become the company’s executive chairman.