The flying machine was an airship in the virtual world, during the Legendary Heroes arc.
A thousand years before the in-game present events a legendary hero was said to have used the flying machine to get to the Castle of Dark Illusions, even passing its magical barrier. The airship was then lost for the next thousand years.
Princess Adena told Yugi, Mai, Joey and Mokuba the legend of the flying machine when they prepared to rescue Kaiba from the castle. Shortly afterwards Mokuba, disguised as Adena, was kidnapped on a battlement. Yugi then realized that a recent storm had blown dust away, revealing the outline of the flying machine drawn on the ground. With the unlikelihood of the machine still working and not enough time to dig it up, Joey used "Time Wizard" to restore the area to the way it was a thousand years previous.
With the airship operational, Yugi, Joey and Mai flew it to the e. However when they got close to the castle, it was incinerated by Salamandras. Since they had passed the magical barrier, they were able to fly the rest of the way on the back of "Winged Dragon, Guardian of the Fortress".