El Ghazi, 21, a former Feyenoord academy player, joined Ajax in 2013 and made his official first-team debut in August 2014, coming off the bench in the 1-0 Johan Cruyff Shield defeat at the hands of PEC Zwolle.
The versatile forward had since developed into an important first-team member at the Amsterdam ArenA but a transfer became inevitable after he fell out with coach Peter Bosz earlier this season.
He was demoted to Jong Ajax for the duration of November, only to return to the first team in December, scoring in the 1-1 Europa League draw with Standard Liege.
His time in Amsterdam has now come to a definitive end, though, as he will continue his career in France, having signed a contract until June 2021.
"I am very happy to be at LOSC," El Ghazi commented on his move.
"I had a very good feeling about this club ever since we started talks. I cannot wait to get started.
"I know that [Patrick] Kluivert and Eden Hazard played here. They are big names and that proves Lille are a big club."