Apple Inc. is betting $1 billion on China’s homegrown competitor to Uber Technologies Inc., marking the technology giant’s largest investment in a critical market at a time when its global fortunes are flagging.

The investment in Didi Chuxing Technology Co., announced late Thursday in California, came on the day that Apple briefly ceded its spot as the world’s most valuable company to Google parent Alphabet Inc., a lingering effect of a quarterly earnings announcement that spooked investors about Apple’s future. Among the...