After the lorry hit a roadside pole, the two got off and threw home-made explosives at the barracks, moving in to hack at police officers with knives, the agency reported.
It said 14 police were killed on the spot and two died from their wounds on the way to hospital, while 16 others were injured.
Both attackers were arrested, one of them with a leg injury sustained during the raid, according to the news agency. Xinhua said debris from five explosives was found near the barracks.
"The raid... was suspected as a terrorist attack," the agency said, citing local police in the city, which is close to the Tajikistan border and around 4,000 kilometres (2,500 miles) from Beijing.
The incident threw a shadow over the Olympic countdown, after government warnings that members of Xinjiang's Uighurs, a Turkic-speaking people, were planning to stage attacks to wreck the Games.
Dilxat Raxit, a Sweden-based spokesman for the World Uighur Congress, said he had been in touch with several people in Kashgar who confirmed an attack had taken place.
Anger was rising among the Uighurs about a pre-Olympic crackdown by Chinese authorities, involving numerous arrests, he said, but he could not confirm if the attack was carried out by Uighurs.
"The police and soldiers just arrest them without any rules," he told AFP by telephone.
Beijing Olympic organisers said it did not know yet if there was a direct connection to the showpiece sporting event, which begins on Friday.
"We have to check," spokesman Sun Weide said.
In line with the flow of information in China surrounding security issues, reports were released only through official channels, while local authorities denied any knowledge of the event.
"Everything has returned to normal," an official with the Kashgar People's Armed Police said by telephone. He declined any other comment.
China has said repeatedly that a major terrorist threat emanates from Xinjiang.
"The Beijing Olympics is facing a terrorist threat unsurpassed in Olympic history," the People's Daily, the mouthpiece of the ruling Communist Party, said in an editorial last month.
China has deployed more than 100,000 security personnel to provide security for the Games, which run from August 8 to 24.
A senior official said last week the main Olympic threats were from the East Turkestan Islamic Movement in Xinjiang, forces seeking Tibetan independence, the banned Falungong spiritual group and overseas pro-democracy forces.
China's state media carries only sporadic reports about violence in Xinjiang, making it difficult to determine the extent of the terrorist threat in the region.
Rights groups and members of the ethnic Muslim Uighur population in Xinjiang have accused the government of exaggerating the terrorist threat as a cover to crack down on all forms of dissent.
It was thought to be one of the deadliest such attacks ever reported in Xinjiang.
"If 16 people died, I would think that this is the highest casualty ever reported for an incident," said Nicholas Bequelin, a researcher with Human Rights Watch and an expert on Xinjiang.
Xinjiang, a vast area that borders Central Asia, has about 8.3 million Uighurs, and many are unhappy with what they say has been decades of repressive Communist Chinese rule.
Two short-lived East Turkestan republics emerged in Xinjiang in the 1930s and 1940s, at a time when central government control in China was weakened by civil war and Japanese invasion.