The warship was "conducting routine operations while transiting the South China Sea", Carter said on Wednesday after a meeting of defense ministers from Southeast Asia in Malaysia, a forum marred by the U.S.-China disagreements over the sea lane.
Beijing has rebuked Washington over the patrol while China's navy commander has warned that a minor incident could spark war in the South China Sea if the United States did not stop its "provocative acts".
"China has consistently respected and safeguarded all countries' freedom of navigation and overflight enjoyed under international law," Chinese Foreign Ministry spokeswoman Hua Chunying said on Thursday when asked about the Carter carrier visit before it took place.
"...What we oppose is waving the banner of freedom of navigation to push forward the militarization of the South China Sea and even provoke and endanger other countries' sovereignty and security interests. In this aspect, we hope the relevant actions and intentions of the U.S. can be made open and above board."
The U.S. Navy plans to conduct patrols within 12 nautical miles of artificial islands in the South China Sea about twice a quarter to remind China and other countries about U.S. rights under international law, a U.S. defense official said on Monday.
U.S. defense officials have said Carter would not be on any warship carrying out such patrols.
"Teddy Roosevelt's presence there and our visit is a symbol of our commitment to our rebalance (to Asia) and the importance of the Asia-Pacific to the United States," Carter said on Wednesday.
Read MoreVague maritime rules increase conflict risk
In July, Admiral Scott Swift, commander of the U.S. Pacific Fleet, was on board a Boeing P-8 surveillance plane as it carried out a seven-hour flight over the South China Sea.
Swift said his flight was routine, but it drew a rebuke from China. In May, Beijing called a U.S. P-8 surveillance flight carrying a CNN team over the South China Sea "irresponsible and dangerous".
The 10-member Association of Southeast Asia Nations (ASEAN) scrapped a joint statement to be issued after their meeting on Wednesday because they were unable to agree on whether it should refer to the South China Sea dispute or not.
The United States had lobbied for inclusion of a reference, while China had argued it had no place in the statement. Carter and his Chinese counterpart attended the meeting.
U.S. Deputy National Security Adviser Ben Rhodes said Washington believed that the U.S. commitment to freedom of navigation was welcomed by ASEAN.
"People want the United States to be present, people want to know that the United States is going to be a stabilizing force ... but they also want us to have a good relationship with China," said Rhodes, speaking at the Center for Strategic and International Studies in Washington.
The United States says it takes no position on the South China Sea claims.
China denies it's impeding freedom of navigation or overflight in the waterway.
Read MoreHow China's military buildup threatens the US
Euan Graham, director of the International Security Program at the Lowy Institute for International Policy in Sydney, said the fact Hishammuddin was with Carter spoke to the Southeast Asian solidarity with Washington that the United States wanted to project.
"But in the actual demonstration of freedom of navigation, I think the reverse question currently applies: Is the U.S. doing enough?" Graham asked.
"It's not so much the provocative statement of the photo opportunity of landing on the deck of the 'big stick' ... If you dig into this carefully enough, you will find, I think, extreme caution in how the U.S. is going about the freedom of navigation assertions."
Last week's patrol by the USS Lassen, which has since joined the Theodore Roosevelt carrier strike group, was the first such mission close to China's holdings in the Spratlys since 2012.
The Lassen's commanding officer, Robert C Francis Jr, said the ship came within six to seven nautical miles of the nearest Chinese formation during the patrol.