The investment gives the tech giant a big stake in the top ride-hailing service in China, where the iPhone maker has otherwise struggled.