From D&D Wiki
Taming: Animals can be tamed to fight on your side of battle. If you have not entered combat with the animal, you can tame them, as described below. If an animal is Large size or larger or is hostile, subtract 1 from the Animal Handling roll. If both, subtract 3. Roll for Animal Handling, 12 or higher to tame for 1d2 hours, 17 or higher to tame for 1d6 hours, 18 or higher to tame for 1d6+2 hours, 20 or higher to tame permanently and make them a pet. Tame animals follow you and are more likely to attack enemies that you attack for the duration they are tame. If an animal is not tamed successfully, flip a coin. On a heads, they flee, and on a tails they become hostile unless you can make a DC 19 charisma save to make them neutral again, after which you must subtract 3 from Taming (Animal Handling) rolls against that animal for 24 hours, in addition to other negative Taming (Animal Handling) modifiers.
Making Tamed Animals Pets: In order for a tamed animal to become a pet, you must (a) enter combat with that tamed animal accompanying you and both of you survive, (b) pay that animal’s challenge rating x10 in gold to bribe that animal with food, or (c) succeed on another Animal Handling check equal to that animal’s challenge rating (rounded) + that animal’s Intelligence + 4.
Leveling up a pet:
Level: Experience to get to level: 1 0 2 100 3 300 4 900 5 2,700 6 5,400 7 8,640 8 9,680 9 10,750 10 14,000
Teaching: Of course, once an animal is your pet, it needs to learn commands to be more useful. As an action, you can use up to two commands on a single pet, but all commands can be used as a bonus action or a reaction. To teach your pet a command, you must spend time with that pet. You can teach your pet while traveling, during a short rest or during a long rest. If you teach your pet, roll 1d20-2+that pet’s Intelligence modifier. On a 11 or higher, your pet gets 1 Teaching Point and on a 20 or higher your pet gets 2 Teaching Points. During a short rest roll 1 die and during a long rest roll 2 dice, and during travel roll dice equal to the number of full hours spent traveling divided by two (rounded down) plus one, but only if the travel was 30 minutes or longer. Teaching Points are spendable below after the first point, which must be spent teaching your pet the “Summon” command. The Summon command simultaneously teaches your pet it’s name and a specific word of your choice in a language/dialect of your choice. Saying this word makes your pet come to you, as long as it is within audible range. This expends your first Teaching Point, regardless of if you got 1 or 2 points simultaneously. Commands by Teaching Points: 1-Fetch-Your pet retrieves an object that you and your pet can see and brings it to you during it’s next combat turn. 1-Seek Scent-Your pet sniffs an object and will either point or go towards another object with the same scent. Unless you were holding the object you show your pet during your Action, this takes an action to show your pet the object and begin switching back to your other equipment. 1-Roll Over-On command, your pet rolls over. In combat, they can roll and attempt to impose disadvantage on the enemy they roll towards and see if they can knock it back or down. The pet cannot knock an enemy back if they are more than 1 size smaller than the enemy. Roll against the enemy’s armor class, and if a 20 is rolled they get knocked prone. Alternatively, up to 3 targets that can see your pet must make a DC 12 Intelligence save or be Charmed until it makes a DC 14 Intelligence check on it’s turn as a bonus action or a reaction. 1-Seek Objects-Your pet can learn to find gold coins through locations, or find a specific kind of cloth you already have. As a whole Action, you can show your pet a material and have them roll a Perception check with an additional +1 bonus to find objects made of the same material 1-Push Object-Your pet can use it’s weight to push an inanimate object within 5 ft of it back up to 10 ft as long as it isn’t more than twice it’s size. 1-Attack-Your pet can engage and attack a target you point out, rather than attacking threats randomly. 1-Speak-You command your pet to make a loud noise. On a 8-your pet’s challenge rating d20 roll, everything within 10 feet of your pet or in a small enough room is Deafened. 1-Stop-You can command your pet to stop doing what it is doing immediately. 2-Wield-You can teach your pet to use small weapons, as long as the damage dice for that weapon is d4 or smaller. 2-Switch Lever/Button-You teach your pet to be able to activate simple machines and mechanics. On a DC decided by the DM Intelligence check your pet can successfully activate the mechanism. 2-Relay Command-Your pet can tell all or one of your other pets a command if it can make a sound. As a whole action, you can specify which pets are told the command, instead of all or one. 2-Play Dead-Your pet can pretend to be dead as long as it isn’t in/on difficult terrain. Everything with an Intellect of 6 or more must make a DC 12 Intelligence save or be Charmed until it makes a DC 14 Intelligence check on it’s turn as a bonus action or a reaction. 2-Move Objects-Your pet can learn to pick up and transport several objects to a location you point out, as long as they are smaller than the collective size of objects. 3-Deliver-Your pet can carry and object to a person they have met after learning this command. You must be holding the object you want to give your pet or this takes up your action. In combat, he person the object is delivered to can take the object as a bonus action or a reaction. 4-Encourage-Your pet makes an encouraging sound and/or motion, allowing all party members within 20 feet or that can see your pet to gain +1 damage with weapons and +1 to Strength, Constitution and Charisma rolls. 5-Critical-You command your pet with motivation, allowing your pet to aim better and hit harder for one attack. On a DC 11 Charisma check, you command your pet to attack, rolling two dice instead of one to hit and doubling the damage dealt with one weapon/attack. Ex: a brown bear’s class deal (2d6 + 4) slashing damage, and that result is multiplied by two. 6-Copycat-Your pet can attempt to replicate an action that you or someone you tell the pet to copy does. After that action is rolled for, you can roll for your pet doing that action with no modifier if that action needs a 20 to succeed at all, a -1 if it needs a 19, and a -2 if it needs and 18 to succeed.
Training: Your pets can be trained to become smarter and stronger at skills. Pets can only be trained 2 times per pet level. To train your pet, you must spend four or more hours with your pet developing their Strength, Dexterity, Constitution, Intelligence, Wisdom, Charisma, speed (5 ft increase), +1 to their attack damage or their resistance to Piercing, Bludgeoning or Slashing damage.
At 5th 10th Pet Level, your pet can mutate and increase their size by one if you spend 15 gold in food for them.