A British Airways (BA) spokesman confirmed that the flight, which touched-down more than 500 miles away from its planned destination, was redirected and later landed safely in Dusseldorf.
The flight was operated by German firm WDL Aviation – which was responsible for the aircraft and cabin crew – on behalf of BA as part of a leasing deal.
A BA spokesman said: “We are working with WDL Aviation, who operated this flight on behalf of British Airways, to establish why the incorrect flight plan was filed.
“We have apologised to customers for this interruption to their journey and will be contacting them all individually.”
It is understood one possibility is that on its final flight on Sunday, the plane had flown to Edinburgh and back and so the same flight plan was repeated again on Monday morning.
The aircraft took off from London City Airport at 7.45am and landed in Edinburgh about an hour later. It is understood the plane was refuelled in Edinburgh before heading off to the German city.
Details of the number of passengers on board the aircraft were not provided by BA.
A spokesman for WDL Aviation said: “We are working closely with the authorities to investigate how the obviously unfortunate mix-up of flight schedules could occur.
“At no time has the safety of passengers been compromised.
“We flew the passengers on the flight with number BA3271 to Dusseldorf after the involuntary stopover in Edinburgh.”
Some passengers took to twitter and @sontrantuan wrote: “While an interesting concept, I don’t think anyone on board has signed up for this mystery travel lottery.”
But the same passenger later said: “This feels like an honest mistake rather than a diversion. The crew was convinced of the Edinburgh flight path from the get-go...”
Frequent flyer, Sophie Cooke, told the BBC that when the pilot first made the announcement the plane was about to land in Edinburgh, everyone assumed it was a joke and she asked the cabin crew if they were serious.
The pilot then asked passengers to raise their hands if they wanted to go to Dusseldorf.
She said: “The pilot said he had no idea how it had happened. He said it had never happened before and that the crew was trying to work out what we could do.”
Ms Cooke also said the plane sat on the tarmac in Edinburgh for two-and-a-half hours before taking off again and it became “very frustrating” as the toilets were blocked and they ran out of snacks.
The mistaken flight also caught the attention of global media, including CNN, the New York Times and India TV.
BBC news journalist Victoria Derbyshire was also among those to have tweeted about the unusual incident. She wrote: “Mad: BA plane lands in Edinburgh instead of Dusseldorf by mistake.”
North Ayrshire councillor, Joy Brahim tweeted: “Did none of the passengers have an internal compass? Did no one notice the captain welcoming them aboard on the flight to Edinburgh or telling them about the weather in Scotland?”
Sign up to our newsletter: enter your email in the box at the top of this article to get daily updates straight to your inbox.