Although the U.S. military gave no details, Afghan officials said there had been heavy fighting about 5 km (3 miles) from the city centre overnight.
The Taliban said in a statement a U.S. air strike had destroyed many houses and killed women and children.
There were angry protests by civilians who brought the bodies of at least 16 dead into Kunduz, Mafuzullah Akbari, a police spokesman said.
The deaths underline the precarious security situation around Kunduz, which Taliban fighters managed to enter last month, a year after they briefly captured the city in their biggest success in the 15-year long war.
The U.S. military gave no details on the identity of the two personnel who were killed or what units they served with and there was no immediate detailed comment on the circumstances of their deaths.
There was also no immediate word on whether any air strikes had been carried out.
“The service members came under fire during a train, advise and assist mission with our Afghan partners to clear a Taliban position and disrupt the group’s operations in Kunduz district,” the U.S. military said in a statement.
Although U.S. combat operations against the Taliban largely ended in 2014, special forces units have been repeatedly engaged in combat, providing assistance to the Afghan army and police.
Masoom Hashemi, deputy police chief in Kunduz province, said police were investigating to try to determine if any of the dead were linked to the Taliban.
Thousands of U.S. soldiers remain in Afghanistan as part of the NATO-led Resolute Support training and assistance mission and a separate counterterrorism mission.
The deaths come a month after another U.S. service member was killed on an operation against Islamic State fighters in the eastern province of Nangarhar.
Afghan forces, fighting largely on their own since the end of the international combat mission, have suffered thousands of casualties, with more than 5,500 killed in the first eight months of 2016.
— This feed and its contents are the property of The Huffington Post, and use is subject to our terms. It may be used for personal consumption, but may not be distributed on a website.