The German champions announced on Thursday that following negotiations with both Real and Alonso, the player will move to the Allianz Arena subject to a medical.
A statement published on Bayern's official Twitter feed read: "#FCBayern confirms talks with Xabi Alonso and Real Madrid.
"The Spaniard is now expected [in Germany] for a medical."
The 32-year-old Alonso, who announced his retirement from international football after winning 114 caps for Spain on Wednesday, signed a two-year extension to his Real contract back in January.
However, he has seemingly been pushed down the European champions' midfield pecking order following the arrivals of Toni Kroos - who joined from Bayern - and James Rodriguez.
Alonso moved to Real from Liverpool in 2009 and quickly established himself as the heartbeat of a team that, under the management of Manuel Pellegrini, Jose Mourinho and Carlo Ancelotti, won La Liga, the UEFA Champions League and two Copa del Reys during his time at the Santiago Bernabeu.
The 2010 World Cup winner is set to become the second Spaniard signed by Bayern coach Pep Guardiola in this transfer window after his compatriot also recruited Alonso's former Liverpool team-mate Pepe Reina.
Alonso will be expected to help cover the long-term absence of another countryman, Javi Martinez, who suffered a cruciate ligament injury in Bayern's DFL Supercup defeat to Borussia Dortmund earlier this month.
Get the best features, fun and footballing frolics straight to your inbox every week.