It is complicated, and the short version is that Terra is a good person who ends up on the wrong side of events.
Master Xehanort takes control of him, and everything Terra does after that point is happening while he is not himself. The tragedy of his story is precisely that he is trying to do the right thing throughout and is overridden at the crucial moment.
Kingdom Hearts Birth by Sleep is built around that inversion, with Terra, Aqua and Ven each being pulled toward a different failure. Calling him a villain misses the point entirely.