The screenplay of Metropolis was written by Fritz Lang and his wife, Thea von Harbou, a popular writer in Weimar Germany. The film's plot originated from a novel of the same title written by Harbou for the sole purpose of being made into a film. The novel in turn drew inspiration from H. G. Wells, Shelley and Villiers d'Isle Adam's works and other German dramas. The novel featured strongly in the film's marketing campaign, and was serialized in the journal Illustriertes Blatt in the run-up to its release. Harbou and Lang collaborated on the screenplay derived from the novel, and several plot points and thematic elements — including most of the references to magic and occultism present in the novel — were dropped. The screenplay itself went through many re-writes, and at one point featured an ending where Freder would have flown to the stars; this plot element later became the basis for Lang's Woman in the Moon.
Metropolis began principal photography on 22 May 1925 with an initial budget of 1.5 million reichsmarks. The cast of the film was mostly composed of unknown actors; Heinrich George was a theater actor, Gustav Fröhlich was a journalist and 19-year-old Brigitte Helm who had no previous film experience though she had given the trial shots for the film Die Nibelungen.
Shooting of the film was a draining experience for the actors involved, due to the demands that Lang placed on them. For the scene where the worker's city was flooded, Helm and 500 children from the poorest districts of Berlin had to work for 14 days in a pool of water that Lang intentionally kept at a low temperature. Lang would frequently demand numerous re-takes, and took two days to shoot a simple scene where Freder collapses at Maria's feet; by the time Lang was satisfied with the footage he had shot, actor Gustav Fröhlich found he could barely stand. Other anecdotes involve Lang's insistence on using real fire for the climactic scene where the false Maria is burnt at the stake (which resulted in Helm's dress catching fire), and his ordering extras to throw themselves towards powerful jets of water when filming the flooding of the worker's city. UFA invited several trade journal representatives and several film critics to see the film's shooting as parts of its promotion campaign.
Helm recalled her experiences of shooting the film in a contemporary interview, saying that "the night shots lasted three weeks, and even if they did lead to the greatest dramatic moments — even if we did follow Fritz Lang’s directions as though in a trance, enthusiastic and enraptured at the same time — I can’t forget the incredible strain that they put us under. The work wasn’t easy, and the authenticity in the portrayal ended up testing our nerves now and then. For instance, it wasn’t fun at all when Grot drags me by the hair, to have me burned at the stake. Once I even fainted: during the transformation scene, Maria, as the android, is clamped in a kind of wooden armament, and because the shot took so long, I didn’t get enough air."
Shooting lasted over a year, and was finally completed on 30 October 1926. By the time shooting finished, the film's budget leapt to 5.1 million reichsmarks.
The effects expert Eugen Schüfftan created pioneering visual effects for Metropolis. Among the effects used are miniatures of the city, a camera on a swing, and most notably, the Schüfftan process, in which mirrors are used to create the illusion that actors are occupying miniature sets. This new technique was seen again just two years later in Alfred Hitchcock's film Blackmail (1929).
The Maschinenmensch — the robot built by Rotwang to resurrect his lost love Hel — was created by sculptor Walter Schulze-Mittendorff. A whole-body plaster cast was taken of actress Brigitte Helm, and the costume was then constructed around it. A chance discovery of a sample of "plastic wood" (a pliable substance designed as wood-filler) allowed Schulze-Mittendorff to build a costume that would both appear metallic and allow a small amount of free movement. Helm sustained cuts and bruises while in character as the robot, as the costume was rigid and uncomfortable.