I always figured he was the bad guy because he was just too perfect. Plus, once Anna and Kristoff are out adventuring together, the audience starts to like the idea that they will fall in love, so if Hans is left back home and turns out to actually be a nice guy, then Anna has to make a choice that will upset half of the audience. Whenever you have two nice guys like that and one gets jilted, it's always kind of awkward and weird. There are some movies that do this too. Hans turning out to be a villain negates all of that and creates a perfect Happily Ever After for Anna and Kristoff.