About 70 hostages facing "imminent mass execution" were rescued in the operation at an ISIS-controlled prison that killed Wheeler, 39, according to a Pentagon statement.
Wheeler, who was was part of the Army's Delta Force and assigned to Headquarters of the U.S. Army Special Operations Command at Fort Bragg, North Carolina, is the first American to die in combat in Iraq since November 2011.
The hostages he was helping to rescue included more than 20 members of the Iraqi Security Forces, local residents and several ISIS fighters accused of spying. They were liberated Thursday after a helicopter assault that involved U.S. special operations troops as well as Kurdish and Iraqi forces, U.S. officials said.
"There was not a lot of time," one U.S. official told CNN on condition of anonymity. "The threat of execution was imminent."
Mass graves dug inside the compound were spotted during surveillance, a U.S. official with direct knowledge of details of the raid told CNN. After the rescue, hostages said they had been told they would be executed after morning prayers.
The firefight represents the first time U.S. forces stepped into combat against ISIS in Iraq, one U.S. official said.
A U.S. Special Forces commander on the ground made the decision to directly engage ISIS fighters during the overnight mission, according to the official with knowledge of the raid.
Thirty troops from Delta Force on an "advise and assist role" participated in the raid when Kurdish "Cobra" commandos were overwhelmed after entering the walled compound on their own, the official said.
Wheeler who was killed was shot inside the compound near Hawija in northern Kirkuk province, badly injured and flown to Irbil, where he died, according to the official.
Four Peshmerga soldiers were wounded, officials said.
There were no Kurds among the hostages, the Kurdistan regional government said. The United States had said earlier about 70 Kurdish hostages were rescued.
Pentagon spokesman Peter Cook said authorities were still assessing who was rescued.
"We did not have a crystal clear idea of who exactly would be at this compound," he said, adding the United States did not have "a full accounting of everyone present."
The mission did not represent a change in U.S. tactics in Iraq, Cook said.
"This was a unique circumstance in which very close partners of the United States made a specific request for our assistance," he said.
White House spokesman Eric Schultz said the Pentagon, not the White House, signed off on the operation under the U.S. military mission against ISIS.
"The Secretary assessed the situation on the ground, saw that U.S. forces could make a difference here, could perhaps make this operation more successful, and at the end of the day there are 70 people whose lives were saved as a result of this," Cook said.
More than 20 ISIS fighters were killed and six were captured, according to the statement from the Kurdistan regional government.
In a statement, Gen. Lloyd J. Austin III, commander of the U.S. Central Command, described the mission as "complex and highly successful."
"We commend and congratulate the brave individuals who participated in this successful operation that saved many lives, and we deeply mourn the loss of one of our own who died while supporting his Iraqi comrades engaged in a tough fight," he said. "Our gratitude and heartfelt condolences go out to this young man's family, his teammates and friends."
Further details about the situation, including the identities of the hostages and hostage-takers, weren't immediately available.
The operation came more than a month after Kurdish security forces said the Islamist militant group ISIS kidnapped dozens of men near Hawija. It wasn't immediately clear whether the overnight rescue was related to this early September kidnapping.
The Kurds are an ethnic group with an autonomous region in northern Iraq. The Kurdish Peshmerga, the military force that protects this region, has been fighting ISIS, which captured parts of Iraq and Syria in an attempt to create what it calls its Islamic caliphate.