Lewandowski, 33, had one year left on his contract with Bayern but had made clear his desire to join Barca, who put him at the top of their summer wish list.
The Poland international, signed from Borussia Dortmund in 2014, scored 50 goals across 46 games last season to help Bayern win a 10th consecutive Bundesliga title, taking his overall club tally to 344.
Barcelona said Lewandowski has a buyout clause of 500m euros (£425.9m) and has signed a four-year contract.
Lewandowski has joined up with the rest of the Barcelona squad in Miami on the club’s pre-season tour to the United States.
“Finally, I’m here, I’m very happy to be here with Barcelona,” Lewandowski told the Spanish club’s media channel.
“The last few days were very long days, but in the end the deal is done, so now I can focus on a new chapter in my life, a new challenge.
“I’ve always wanted to play in La Liga and for the big clubs. I am here to help Barca get back to the top and win as many titles as possible.”