In one of my first stories, I had the main character in a surly mood in the opening scene without telling the reader why he was acting the way he was. A friend who critiqued the story wrote in the margin, "Who pissed in his oatmeal this morning?" It's a comment I hear in my head every time I discover I need to rewrite an under-motivated character.
Characters should have very good reasons to act as they do. We must give them motivations that the reader can understand. The most common mistake most new writers make is having a character act in a certain way because the writer needs her to act in a certain way.
This is as true for the villain as it is for the main viewpoint character. If your bad guy doesn't act without proper motivation, the whole story falls apart.