Apple import iPhones manufactured by factories in China. Apple has to pay for these Chinese manufacturers. So, Apple should be in debt with Chinese manufacturers. But why do we say the US government is in debt to China?
Because, regardless of private debts of Apple, the US government is in debt to China.
As of September 2014, foreigners owned \$6.06 trillion of U.S. debt, or approximately 47% of the debt held by the public of \$12.8 trillion and 34% of the total debt of $17.8 trillion. As of 2018, the largest holders were China, Japan, Ireland, and Brazil.