Lacazette, 31, joined Arsenal from Lyon in 2017 and has made 206 appearances across all competitions and scored 71 goals.
"Five years ago, my dream came true.. To sign for @arsenal .. It's been an honour to wear the jersey, to be a part of this family. I won trophies, I met real and nice [people], and I fell even more in love with this club," he wrote on Instagram.
"Good luck for the future of the club and the fans, it's been a pleasure.
"Once a gunner, Always a Gunner. Thank you Arsenal."
His future has been the centre of speculation for months and the announcement that he is leaving won't come as a surprise.
He said in April that he was in talks with several clubs as the end of his contract neared and hinted that he wanted to join a side who are competing in the Champions League.
Arsenal finished fifth this season, outside the Champions League places. Lyon finished in eighth place in Ligue 1.
"Laca has been a fantastic player for us," head coach Mikel Arteta said in a statement.
"He's been a real leader on and off the pitch and has been a very important influence to our younger players.
"His commitment with us has been exceptional and we wish him and his family success and happiness."
Lacazette was Arsenal's top scorer during the 2017-18 and 2020-21 seasons and is in the club's all-time top 10 Premier League scorers.
During his time with the club he won the FA Cup and the Community Shield.
James Olley contributed reporting to this article.