One local soldier was also wounded in the attack, the U.S. military said in a statement, without clarifying whether that fighter was part of the Somali or Kenyan armed forces.
The troops had been on a mission to clear al-Shabaab from contested areas as well as villages the militants controlled, the U.S. military's Africa Command said in a statement.
About 500 U.S. troops are deployed in Somalia.
The US military has stepped up its airstrikes in the Horn of Africa nation after getting US President Donald Trump’s approval for expanded military operations there.
In June 2011, American forces began using drones to carry out the strikes, in a mission which has so far failed to uproot the militancy in the country.