The 29-year-old saw a proposed move to Bayern break down at the final moment last summer, but the German champions retained an interest in the Portuguese.
Bayern have now confirmed the arrival of Palhinha, with the German giants agreeing to pay an initial £43.4m plus £4m in add-ons, according to Sky Sports News.
"This is one of the happiest days of my life. I'm now playing for one of the top clubs in Europe. It's a dream come true for me, and I'm very proud of that," Palhinha told Bayern's official website.
"I'm looking forward to the atmosphere and the fans at the Allianz Arena. I want to enjoy success with FC Bayern and win titles - I'll give it my all."
Palhinha earns Bayern move after previous breakdown
Meanwhile, Bayern's board member for sport Max Eberl added: "Joao Palhinha was highly sought after by FC Bayern even last summer - and rightly so. It was important that we never lost touch.
"Joao really wanted to come to Bayern, and we need players like that. He's an important building block for our future.
"He's once again demonstrated his strengths on the big stage at the Euros and brings a lot of experience, having previously played at a Euros and World Cup, and making around 300 appearances in the Portuguese and English leagues. He will give us greater stability in the centre."
Palhinha joined Fulham from Sporting Lisbon in 2022, and he has left the Premier League club having scored eight goals and registered one assist in 79 appearances in all competitions.
Last season, the midfielder scored four goals and provided one assist in 39 outings for Marco Silva's side, but he will now turn out for one of the biggest clubs in world football next term.
Khan brands Palhinha "a fantastic player"
Fulham vice-chairman Tony Khan told the English club's official website: "Joao Palhinha has been a fantastic player for Fulham since he joined us in July 2022. His formidable presence in the midfield, his aggressiveness and phenomenal skill have made him a fan favourite and a leader on the pitch for Fulham.
"All of us at the club are grateful for Joao's hard work, the time we shared with him, and the great memories from these past few years working together.
"We've reached an agreement today that could result in the highest transfer negotiation in club history, with these resources coming in at an essential time in our summer squad planning for the season ahead and our long-term future. We wish Joao the very best in his new journey. Come on Fulham!"
Palhinha was in action for Portugal at this summer's European Championship, making four appearances at the competition, as Roberto Martinez's side reached the quarter-finals.