The claim was made in a statement distributed on social media.
USAID, an American government agency for poverty prevention, identified one victim as Xulhaz Mannan. Mannan worked at the organization but also served as editor of the country's first LGBT magazine. "Today, USAID lost one of our own," the statement said.
"He was the kind of person willing to fight for what he believed in, someone ready to stand up for his own rights and the rights of others," USAID Administrator Gayle Smith said in a statement.
The other victim was Tanay Mojumdar. Like Mannan, he was openly gay and was a leader in the fight for LGBT rights, a British photographer told CNN's Ivan Watson. The photographer did not want to be named for fear of being barred from Bangladesh.
The two were not romantically involved with each other, the photographer said.
Human Rights Watch, an international non-governmental organization, called on Bangladesh to investigate the killings of the two activists.
Monday's attack follows several others in Bangladesh since 2013, including the hacking death of a professor at a bus stop Saturday and the killings of several bloggers -- six in the past 12 months alone.
"They knew ... there was a danger"
Tanay Mojumdar, the photographer said, was a "minor celebrity" who had acted in a hit play in Bangladesh and appeared on television.
"Tanay got a threat last year because he was photographed in the gay pride parade," the photographer said. "And that photograph was published in places in the Bangladeshi newspapers.
"They knew that basically, there was a danger," the photographer said. "There was a threat because there had been all these bloggers killed and a couple of foreigners killed," the photographer said. "They decided not to tell everyone because it would spread fear. They were encouraging everyone to be open."
Mannan oversaw Roopbaan, a Dhaka-based LGBT magazine that describes itself as "a platform and publication promoting human rights and freedom to love in Bangladesh."
The Roopbaan team had been receiving threats from various Islamist pages on Facebook for some time, said Boys of Bangladesh, the country's largest gay rights group. Mannan had been a prominent member of Boys of Bangladesh since 2005 and many of its leading activists have been living in fear, it added.
Attackers posed as couriers
The two were in an apartment when five or six young men posing as couriers arrived under the guise of delivering a package, said Mohammad Iqbal, the officer in charge of the Kalabagan police station.
The attackers entered the second-floor apartment and hacked them to death with machetes, Iqbal said. Mannan's mother and a maid were also in the flat at the time, he said. Both are alive.
"The brutal killing today of an editor of an LGBTI publication and his friend, days after a university professor was hacked to death, underscores the appalling lack of protection being afforded to a range of peaceful activists in the country," said Champa Patel, Amnesty International's South Asia director.
Second hacking attack this week
The killings come a day after Bangladeshi police detained a university student in the hacking death of 58-year-old Rezaul Karim Siddique
, an English teacher at Rajshahi University.
Rajshahi police Commissioner Mohammad Shamsuddin said the student wasn't charged and it remained unclear why Siddique had been stabbed in the neck as he awaited a bus to take him to campus Saturday.
"He was neither a blogger nor an anti-Islamic campaigner, but the pattern of the murder indicates Islamist militants involved in the recent spate of killings of secular bloggers might have a link," Shamsuddin said.
ISIS claimed responsibility for Siddique's death, saying he was slain "for calling to atheism." CNN could not independently confirm either the terror outfit's claim or Siddique's religious beliefs.
Extremists have 'hit list'
Reports of hacking deaths go back to 2013 in Bangladesh, most of them targeting bloggers. Since last year, Nazimuddin Samad
, Faisal Arefin Dipan
, Ananta Bijoy Das
, Niloy Neel
, Washiqur Rahman
and Avijit Roy
are among the writers who have been killed.
In September, Islamic extremists said they wanted to take their war against secular writers beyond Bangladesh's borders. They released a "hit list"
of people they would target in Europe and North America.
"Let Bangladesh revoke the citizenship of these enemies of Islam," a statement accompanying the list says. "If not, we will hunt them down in whatever part of God's world we find them and kill them right there."
Amnesty alleges that Bangladesh authorities have done little to discourage such attacks. Exiled lesbian, gay, bisexual and transgender activists told the watchdog group that when they attempted to report threats to authorities, police responded by warning them they could be charged with "unnatural offenses."
Rather than offer security, Amnesty said, police have warned LGBT activists to be "less provocative."