some people spam food into the pets and think that's just gonna work like that, make sure you wait for the feeding buff to end to feed it again and keep it happy until it gains loyalty, once the pet has loyalty you dont need to worry that much about the food
When you first tame a pet it's empty, so you have to fill it up. You need level-appropriate food and a bit of patience to let your pet eat. Every time you send it into combat it loses happiness, so make sure it's all green and smiley before you use it in battle.