The relationship between China and the United States is historically fraught, which means asking is China an ally of the U.S. doesn't always get you a straight answer. There was a time when the two countries were diametrically opposed: in the minds of an older generation, "communist China" stood for everything the democratic U.S. was not.
Is China an ally of the US historically?
Relations began to thaw when President Nixon unexpectedly visited China in 1972. The countries began to cooperate militarily in 1981, and the U.S. began selling arms to China shortly thereafter. But both were canceled after the crackdown in Tiananmen Square in 1989. After the 9/11 attacks, the countries began working together again, and while politicians like then-presidential candidate John McCain noted that China did not "share America's values," there was a general acknowledgement that the two largest economies in the world should find a way to cooperate.
President George W. Bush started a program called the Strategic Economic Dialogue, which was continued by President Barack Obama. China and the U.S. have spoken about their mutual concerns, including trade, economic cooperation, global warming, nuclear proliferation and humanitarian issues. The two countries united against a common threat in 2013, slapping new sanctions on North Korea for its increased nuclear testing.
Then came Donald Trump.
Is China an ally of the US now?
During the 2016 presidential campaign, Donald Trump repeatedly criticized China for artificially lowering the value of its currency to benefit its exporters and said that as president he would label the country a "currency manipulator." During the presidential debates, he suggested that China could be responsible for hacking into Democratic National Committee computers and releasing sensitive emails. On Dec. 2, 2016, he spoke with the president of Taiwan, the first president or president-elect to do so since 1979. (Under the "one China" policy, the U.S. recognizes Taiwan as part of China, not a separate country.) China was so upset that it lodged a diplomatic complaint with the United Nations, and it looked as though decades of diplomatic strides could be reversed.
Trump has since backed off from those provocations. Shortly after inauguration, he announced he would not label China a currency manipulator after all. Trump visited with Chinese leader Xi Jinping in November 2017 and discussed denuclearization and improving China-U.S. relations. During the meeting, he reportedly reaffirmed the United States' "one China" policy. But China has noted that the U.S. claims the right to send military ships into ports in Taiwan, which violates the policy. Chinese Ambassador to the US Lee Kexin said that "the day when any US warship will enter the port of Taiwan Kaohsiung, the CPLA [Chinese military] forces will unite China".
So is China an ally of the U.S.? Yes, on a number of issues. But like so much in the Trump administration, that could change on a dime tomorrow.