No matter how many times I hear it, it seems confused. Was Black Sabbath singing about the Marvel comic book hero and got it wrong, or was the song based on some other Iron Man?
The Black Sabbath song was an original composition by the band based on the concept of someone who travelled in time back from the future, but was turned to immobile steel upon arrival. It just happened to share a name with the Marvel comics character, who is not generally regarded as a time traveller or immobile (although he has probably had adventures where he satisfied either of those conditions).
Ozzy discusses the meaning of the song, and the posted answer above is true. Fast forward to around 22:50 in the interview:
Question: What's the real story behind Iron Man?
Ozzy: Well, it was Geezer Butler, the bass player of Sabbath who brought me the lyric. And what it was about, was a guy who travels through time, and he goes to the future, and he sees the demise of mankind. On the way back to the present time, he goes through this macabre thing, and he gets turned to iron. And he gets so frustrated trying to warn mankind about this impending doom, that he ends up losing it and he starts killing everybody himself.