Hopetully, the strange/rude behavior is just a one-time thing. As others pointed out, he may be busy, had a bad day, just received rejection for his paper/grant/whatever. Although, none of these should justify his behavior. After all, it is his job to advise you in course selection. But professors are also human: they get cranky, annoyed, stressed, etc.
If the rude behavior becomes a habit, then you may want to seek another professor as an advisor.