BEIJING — Apple Inc.’s Chief Executive Tim Cook defended globalization in a rare public speech in China, as his company faces political pressure in the U.S. to bring back factories.

Mr. Cook also said data privacy was one of the company’s values, although he stopped short Saturday of criticizing decryption demands from governments as Apple has previously in the U.S. It was his first time speaking at the China Development Forum, an annual conference sponsored by China’s central government. It came as part of a broader charm...