Arnold Schwarzenegger once said that you have to walk into a gym like you own it, no matter if you're the biggest guy or the smallest guys. This doesn't mean walking into a gym and running your mouth to everyone. Let your body and body language speak for you. Stand up straight, chest out, and head held high. Don't slouch with your shoulders rolled forward while staring at the ground. Walk like a big guy, even if you're not. Trust me, people will definitely look at you differently. You would be surprised at how many people are more concerned with who is around them than they are with what they are doing.
Try to avoid that pissed off look that some people strive for, you'll just make yourself look like an a-hole. Some people think that by looking like this, that they will intimidate others. Most people can recognize this as a front anyways. I've always gotten a lot of criticism outside of the gym for not talking to anyone, even my friends or family, while I workout. So what, why would I talk? It doesn't make any sense to me to walk into a gym like it is some social event. It takes work to build up intense concentration and even more work to maintain focus, so don't risk losing that. You can walk into a gym and talk with your buddy or something, but after you pick up your first weight, then it's all business. There is plenty of time in the day to talk all you want before and after a workout. If you really feel like you have to talk, then bring a walkman with music that will get you going. I've found that a walkman will increase your ability to keep your focus. In addition, you need to keep a workout log which will both keep you busy, and keep track of your progress. One time, I walked into the gym with a walkman and a hat pulled down. No one recognized me. It was great. It was like I was working out in a new gym. Not even my friends knew who I was.
Avoid grunting or yelling while you workout. This will make you look both goofy and hungry for attention. Truthfully, I'd rather my workout partner yell at me or count my reps loudly. That's another thing, if you have a partner, you will be able to hold your focus, and you'll be able to compete with someone in order to make yourself work harder. One of my favorite things to do is going into the gym about 1-2 weeks out from a contest, doing really light weight and then spending the majority of the time posing in the mirror. What's best is if your partner goes in with you and gives you pointers on posing to make it look like you're truly working on posing when you're really making everyone else feel like crap because they still look the same as when they started. I use to go in covered up and after I get a couple of sets into the workout, I'd uncover and begin posing. If someone that I didn't like much was working out in front of the mirror, I would go and do a set of whatever right next to him/her and then when I finished, I would pose in the mirror. You get some critics, but who cares, if you work hard, then appreciate it.
Like I said, avoid talking shit to anyone, let your actions speak for you. My roommate worked in the gym, and he would come home everyday with something else that people had said to him about me (1-2 weeks pre-contest). It was a lot of fun, but you can't let it go to your head. If someone comes up to you after you workout or whenever, don't be a butthead. It takes a lot for someone to ask for advice from a total stranger. I've never believed in acting like an ass to someone who may know a little less than you about working out. Give back because somewhere down the line, someone helped you out too. There's a fine line between being confident and arrogant, try not to cross that line.
Now, when you're out of the gym, don't talk to all of your friends about working out. You'll look like a complete dumbass and a muscle-head (You can disregard this if you're talking with a fellow muscle-head). There's nothing worse than a single-minded person. I try to avoid talking about the gym outside of the gym. Let others know that there is more to you than just dumbbells.
Beware, there's always that one person who will come up to you while you are training and say "Why do you do that exercise?" in a condescending tone. There are a couple of things you could do. You could be a prick and say "Shut the hell up, I'm trying to workout!" or you could just say "Well, it works for me." I'd go with the latter, don't be a hot-head if someone comes up to you and tries to question you during your workout. Believe it or not, you'll find that same person coming up to you asking for advice later on.
Remember, walk confident, don't grunt/yell, don't be a hot-head, no conversing during the workout, and right before a contest, pose as much as possible, but not too much (just a couple of poses at a time)! Above all, have fun!