If a person does not feel good about their body image are they allowed to exercise or diet in order to change the way they look in order to improve self esteem?

Yes they are absolutely allowed to do that. It is completely permissible.