It really depends on which hero your talking about. The only one that really dresses like that anymore is superman. I guess when they were drawn in the 60's and 70's the artists had a fascination with undergarments. Look at Wonder Woman. They just made her outfit underwear. (Thank you Lynda Carter for wearing it, and yes I realize I said depends answering an underwear question.)
It's to keep the crotch of their pants where it's suppose to be. They can't run and chase bad guys with the crotch down around their knees. Haven't you seen videos of kids trying to run, and hold up their pants?
It provides transition and contrast between the leotard and tights. Besides, a man in just a leotard and tights is a little weird (see blue man group) but somehow putting undies over the whole thing and throwing on a cape makes it perfectly normal. ??? I don't know. I took a shot.
Easy. Gets them through the TSA checkpoints faster. You dont think they REALLY let batman wing around the city with his utility belt on, do you? So he wears his underwear outside to remind himself to put the utility belt on last. That way, he don't gotta undress to get through his gate.
It's because they were modeled after Wrestlers or something. Honestly, I just think artists back then had an underwear fetish. I don't think current heroes wear briefs over their tights or whatever anymore. The New 52 Superman and Batman sure don't. My question is, when did Superman start wearing a belt and what the hell is it holding up?
That was considered "cool" back when their costumes were first designed. If you look at modernized versions, you will see that the "underwear" outside of the suit has been removed (see Arkahm Asylum/ Arkham City, Injustice: Gods Among Us, DC Universe Online)