Director Gilliam cast Depp as time travelling advertising executive Tony Grisoni in the film a decade ago, when it was titled The Man Who Killed Don Quixote.
A series of disasters, including financial problems and the destruction of sets, shelved production of the oddball epic, and now the Pirates of the Caribbean star has been forced to bow out, citing scheduling conflicts.
Gilliam has announced McGregor will take on the Grisoni role, opposite Robert Duvall as Quixote, stating, "There's a lot of colours to Ewan that he's not been showing recently and it's time for him to show them again.
"He's got a great sense of humour and he's a wonderful actor. He's wonderfully boyish and can be charming - when he flashes a smile, everybody melts. He wields it like a nuclear bomb!"
He's not the only replacement in the film - French actor Jean Rochefort was originally cast as Quixote.
The early disasters that crippled the film were chronicled in the 2002 documentary Lost in La Mancha.