According to reports in Italy, Pepe had told Napoli boss Carlo Ancelotti that he would sign for the club.
But Arsenal swooped in and have now agreed a deal with Lille worth £72m for their star winger.
The Ivorian’s stunning season in Ligue 1 saw him linked with some of the top clubs in Europe.
Pepe was the only player in Europe’s top five divisions to have over 100 shots, win over 100 fouls and complete over 100 take-ons in the league in 2018-19.
And according to Italian newspaper La Repubblica, Napoli believed they set to win the race for his signature.
They claim Pepe told Ancelotti that he was ready to move to Italy, but Azzurri owner Aurelio De Laurentiis was unwilling to meet Lille’s valuation of him.
The BBC give a different version of events, stating that Napoli met Lille’s asking price, but their proposal was rejected by the player’s camp.
Lille president Gerard Lopez recently revealed four clubs had submitted bids that were acceptable but the Gunners appear to gave emerged as the victors.
“Last year we asked Pepe to stay with the promise that we would sell in this transfer window,” he said earlier this week.
“But we have received offers that satisfy us economically from four big clubs.
“[Napoli chairman Aurelio] De Laurentiis has satisfied our request for €80m. Now it is up to the player to decide where he wants to go.”
Pepe looks set to become Arsenal boss Unai Emery’s fourth signing of the summer window.
Brazilian youngster Gabriel Martinelli, 18, and loanee midfielder Dani Ceballos, 22, have joined from Ituano and Real Madrid respectively.
Arsenal also paid £27m to secure 18-year-old centre-back William Saliba but he will spend next season on loan at Saint-Etienne.
Tottenham were also interested in the Frenchman but he chose the Gunners over their north London rivals.