The lyrics of the song tell a true story: on December 4, 1971, Deep Purple had set up camp in Montreux, Switzerland to record an album using a mobile recording studio (rented from the Rolling Stones and known as the Rolling Stones Mobile Studio - referred to as the "Rolling truck Stones thing" and "the mobile" in the song lyrics) at the entertainment complex that was part of the Montreux Casino (referred to as "the gambling house" in the song lyric). On the eve of the recording session a Frank Zappa and The Mothers of Invention concert was held in the casino's theatre. During the gig a fire broke out: "In the middle of Don Preston's synthesizer solo on "King Kong",
the place suddenly caught fire. Somebody in the audience had fired a flare gun into the ceiling, at which point the rattan covering started to burn", as mentioned in the "some stupid with a flare gun" line. The resulting fire destroyed the entire casino complex, along with all the Mothers' equipment. The "smoke on the water" that became the title of the song (credited to bassist Roger Glover, who related how the title occurred to him when he suddenly woke from a dream a few days later) referred to the smoke from the fire spreading over Lake Geneva from the burning casino as the members of Deep Purple watched the fire from their hotel across the lake. The "Funky Claude" running in and out is referring to Claude Nobs, the director of the Montreux Jazz Festival who helped some of the audience escape the fire.
Claude Nobs (2006), the "Funky Claude" mentioned in the songLeft with an expensive mobile recording unit and no place to record, the band was forced to scout the town for another place to set up. One promising venue (found by Nobs) was a local theatre called The Pavilion, but soon after the band had loaded in and started working/recording, the nearby neighbours took offence at the noise, and the band was only able to lay down backing tracks for one song (based on Blackmore's riff and temporarily named Title nº1), before the local police shut them down.
Finally, after about a week of searching, the band rented out the nearly-empty Montreux Grand Hotel and converted its hallways and stairwells into a makeshift recording studio, where they laid down most of the tracks for what would become their most commercially successful album, Machine Head.
Ironically, the only song from Machine Head not recorded in the Grand Hotel was "Smoke on the water" itself, which had been recorded during the aborted Pavilion session; only the lyrics were composed later, and the vocals were laid down in the Grand Hotel.