Hey bud, this is actually pretty common, certainly more common than you think and it has nothing to do with being sexually attracted to men or the other guys in the shower. REmember that our mind is a powerful thing and that our two heads are very connected! This could be the result of being uncomfortable, nervous or even being worried about having it happen. Hopefully in time it will stop happening. Until then maybe very your time so that others aren't around as much or simply forget about this having happened at all. THis is one of those things that we're so freaked about having it happen at all like that that we can almost make it worse. Good luck, hang in there and please don't think you're experiencing some homosexual desires (unless of course you are and that is OK too...but I hear you saying that isn't the case) Just remember that "it" sometimes has a mind all its own!
I find it helps if I talk to other who are in there with me. Talk about professors, sports, etc. In time you will not have a problem. It just takes get used to doing it with others. Sometimes it helps to keep the shower short and a little on the cool side.
Let us know what you try and how it works for you.
If you were sexually attracted to men, you'd be attracted to them outside of the showers, too. You're probably just a little exited and nervous about being naked around other naked people. Do they have private showers? Or maybe you could take a shower when nobody else is there. I always hated group showering in school and resented the fact the ladies had private showers. In high school we had a gym teacher who would sometimes take attendance in the shower area. I'm sure he meant well, and didn't want anyone going back to class stinky, but I was never one to sweat too much, so if he didn't take shower attendance, I didn't take a shower. Keep your mind focused on other things, and I'm sure there are other guys there that are also getting erections. I got semi hard one time in a group shower and it was really embarrassing, but who knows, maybe nobody even saw it.
Hey dude, nothing to sweat about. We're guys, and are penises are pretty much independent and unpredictable, especially for younger dudes as I assume you are. Getting an erection in the men's showers does not mean you are turned on by other guys. You're probably just a little excited about being around nakedness in general, you're nervous, there's temperature changes (sometimes I get erect or semi-erect when I first hop in my own shower at home - and I'm not thinking about sex).
Some things to remember: try not to worry about it if you can since that worry may lead to it actually happening; there are probably many other guys in that shower that are worried about the same thing happening to them. Just concentrate on the task of cleaning youself and it'll be less likely to happen.
If it does happen, and someone points it out, I'd suggest trying to make light of it. Maybe a joke about how the "mighty cobra is stretching after getting out of bed" or something.