Baymax is very straightforward about what his purpose is. He tells Hiro that he is to help people and not hurt them.