The title of the song was conceived by Ozzy Osbourne. Geezer Butler took to writing the lyrics around the title. The song was originally entitled "Iron Bloke". Upon hearing the main guitar riff for the first time, Osbourne remarked that it sounded "like a big iron bloke walking about". The title was later changed to "Iron Man".
Despite the song's title, it bears no connection to the Marvel superhero character Iron Man, which was created and first appeared in Tales of Suspense # 39 March 1963 (though it has become associated with the character due to this misconception, and was used in the 2008 film Iron Man based on the Marvel character). Butler wrote the lyrics as the story of a man who time travels into the future, and sees the apocalypse. In the process of returning to the present, he is turned into steel by a magnetic field. He is rendered mute, unable verbally to warn people of his time of the impending destruction. His attempts to communicate are ignored and mocked. This causes Iron Man to become angry, and have his revenge on mankind, causing the destruction seen in his vision. The vocal effects on Osbourne's opening line, "I am Iron Man", were achieved by having him sing from behind a metal fan.
This was the second Black Sabbath single in the US, but it was not released as a single in England. It got very little radio play in the US, but developed a cult following, which led to enough sales to give it a chart position.
A new version was included on the 2000 Reunion album. It won the Grammy that year for Best Metal Performance.
Ozzy recorded a new version of this for the 1994 Black Sabbath tribute album Nativity in Black. Ozzy also recorded a version of this with Busta Rhymes in 1998 for Bustas's album Extinction Level Event (Final World Front). The track was renamed "This Means War". The version with Busta Rhymes was included on the Black Sabbath tribute album Nativity in Black II. On his 2001 song "Get Me Through", Ozzy referenced this in the line, "I'm not the antichrist or the Iron Man".
In 2007 Nissan used this in commercials for their pickup trucks.
The common misconceived tie between the song and the comic book character was spoofed in the 2008 film Iron Man. The film's novelization goes on to also state that the song is Tony Stark's favorite, hence why he picked the title to baptize his superhero alter-ego.
Frank Zappa once surprised members of Black Sabbath by covering this song with his own band at a gig that Sabbath attended. 
Cancer Bats covered the song on the 2013 re-issue of their 2012 album Dead Set on Living. This "Deluxe" or "Bat Sabbath" version included 9 extra tracks, all being Black Sabbath covers.
Tanzwut used the main riff as melody in their song "Eisenmann" on their self-titled debut album.
In other media
In the Marvel Comicsuniverse, it is implied through retcon that Tony Stark named his superhero identity Iron Man after the song, as he claims he was a fan of the band as a child. The song itself is featured in the 2008 Marvel Studios film Iron Man (closing credits), its initial trailer and the video game tie-in. In reference to the song, Stark wears a Black Sabbath t-shirt throughout the crossover film The Avengers.