SHANGHAI—Three UCLA basketball players who had been under police investigation for a week in China flew home, hours after President Donald Trump said he had requested assistance on their behalf from his counterpart Xi Jinping.

UCLA freshmen LiAngelo Ball, Jalen Hill and Cody Riley departed from Shanghai’s Pudong International Airport late Tuesday on a Delta flight bound for Los Angeles. Their exit came after a week of tension, with the players detained by police in the eastern city of Hangzhou as suspects in an investigation...