The 42-year-old, with no previous coaching experience, replaced Carlos Alberto Parreira, who resigned last Wednesday following Brazil's disappointing performance at the World Cup.
The five-times champions were surprisingly knocked out in the quarter-finals by France after beginning the tournament in Germany as hot favourites.
The Brazilian Football Confederation (CBF) said on its official Web site that Dunga agreed terms after a two-hour meeting with its president Ricardo Teixeira.
The CBF did not say how long Dunga would be in charge but he said his appointment was part of a restructuring of the national team set-up that had the 2010 and 2014 World Cups as targets.
The midifelder, famous for his fighting spirit, captained the Brazil team that won the 1994 World Cup and wore the armband again four years later when they were runners-up
He was also in the 1990 team.
"I want to bring the same determination I had as a player," Dunga told the CBF's Web site.
"Motivation and will to win are fundamental for anyone who wants to wear the shirt of the Brazilian national team."
The favourites to replace Parreira had been ex-Real Madrid coach Vanderlei Luxemburgo and former Peru coach Paulo Autuori.
First-choice Luiz Felipe Scolari, who led Brazil to the 2002 world title, preferred to stay with Portugal until 2008.
Dunga's first game in charge will be a friendly against Norway in Oslo on Aug. 16. Brazil are not due to play any competitive games until next year's Copa America in Venezuela.
Dunga faces a tough rebuilding job and one of his first decisions will be the international future of forward Ronaldo, who looked out of sorts at the World Cup.