While I see someone else has already commented, I'd like to throw my hat in the ring.
Batman is one word because that's how DC has done it, for the most part. For example, DC's cast includes Batman, Superman, Aquaman, Catwoman, Supergirl, and many others that are just one word.
Marvel is a little less simple. Iron Man has a space because 'Iron', in this case, is being used as an adjective. That can be interpreted as a 'man of iron', or a 'man that is iron', which both sort of describe his "superpower", meaning his armor.
Spider-Man is even more confusing. Stan Lee originally added in the hyphen so his name would visually look different from Superman, as without it, they look kind of similar. Though I personally think it also might go a bit deeper. 'Spider', unlike 'Iron', is a noun, so it grammatically wouldn't make sense as Spider Man. Other characters like Ant-Man and even the obscure Moon-Boy follow this [Noun]-Man pattern.
However, there are always outliers. For some reason, Wonder Woman is two words, and Moon-Boy's successor, Moon Girl, is two words as well. However, it is important to note that some characters might have different spellings due to other reasons. For example, Sandman is one word as he's named after the mythical character known as the Sandman, and somewhat similarly, Daredevil is one word because 'daredevil' is a common phrase.
Iron Man is Marvel
And spider-man is marvel owned by Sony
Batman is one word because that's how DC has done it, for the most part. For example, DC's cast includes Batman, Superman, Aquaman, Catwoman, Supergirl, and many others that are just one word.
Marvel is a little less simple. Iron Man has a space because 'Iron', in this case, is being used as an adjective. That can be interpreted as a 'man of iron', or a 'man that is iron', which both sort of describe his "superpower", meaning his armor.
Spider-Man is even more confusing. Stan Lee originally added in the hyphen so his name would visually look different from Superman, as without it, they look kind of similar. Though I personally think it also might go a bit deeper. 'Spider', unlike 'Iron', is a noun, so it grammatically wouldn't make sense as Spider Man. Other characters like Ant-Man and even the obscure Moon-Boy follow this [Noun]-Man pattern.