American Kevin King and Australian Timothy Weeks landed overnight at the US Air Force's Ramstein airbase in western Germany, and would be staying nearby "for a period of evaluation and reintegration", the US official said.
King and Weeks, both professors at the American University (AUAF) in Kabul, were kidnapped by gunmen wearing military uniforms in the heart of the Afghan capital in August 2016.
American ambassador to Germany Richard Grenell told Fox News he had greeted the former hostages off the plane and handed King a US flag.
"It's one of the most emotional things that I get to do... to represent (President Donald Trump) and the American people and have this moment with a freed hostage where I say, we never forgot about you," Grenell said.
He added that the exchange was a sign of "the power of diplomacy", and thanked the Afghan government for its role in the swap for three high-ranking insurgent prisoners.
"We got them back!" Trump tweeted later Thursday.
Afghan President Ashraf Ghani said that he and Trump had spoken by telephone, and the US president had invited him on an official visit to the US.
"Both leaders exchanged opinion about the peace process and progress of Afghan security forces," the Afghan presidency said in a statement.
"Trump thanked Ghani for the release of the two AUAF lecturers."
Washington, Kabul and insurgent leaders have hailed the exchange as an important step in peace negotiations for war-torn Afghanistan.
One of the men released in return for the Westerners was Anas Haqqani, brother of the Taliban's deputy leader.
Follow us on Twitter and Instagram to stay connected