“America’s policy continues to be one valued on principles of peaceful resolutions of disputes, lawful settlement of things like territorial disputes like the South China Sea, or anywhere else, freedom of navigation, freedom of commerce,” Mr. Carter said at the time.

The denial was the first time the Chinese government had refused to allow an American aircraft carrier into the port in Hong Kong since August 2014, according to Pentagon officials. The Navy had asked the Chinese to let the Stennis and accompanying vessels visit the port next week, the officials said.

There is currently a United States Navy ship in port in Hong Kong, the Blue Ridge, Kristin Haworth, a spokeswoman for the American Consulate in Hong Kong, said by telephone. The Blue Ridge is the command ship of the United States Seventh Fleet.

“We have a long track record of successful visits to Hong Kong, including the U.S.S. Blue Ridge, and we expect that to continue,” she said.

American naval vessels are frequent visitors to Hong Kong, regarded as one of the most desirable ports of call because of its night life and shopping. Before the 1997 return of Hong Kong to Chinese rule, entry was never a problem because the city was governed by Britain.