There are no rules in 5e for the mechanics of having a pet or working animal that are not explicitly granted by class features or spells, other than purchase prices and stat blocks listed for some animals.
In the absence of a class feature or spell which grants you access to a companion, familiar, mount, or other special animal accompaniment, your DM may allow your character to have a creature (typically a beast) as a pet or working animal that follows your character's bidding as its temperament and mental ability scores allow.
If so, your DM may require your character to make a Wisdom (Animal Handling) check to maintain control over the creature in any situation in which there could be any doubt whether the creature will follow your instructions, as indicated in the rules for the Animal Handling skill (PHB 178).
Animal Handling. When there is any question whether you can calm down a domesticated animal, keep a mount from getting spooked, or intuit an animal's intentions, the DM might call for a Wisdom (Animal Handling) check. You also make a Wisdom (Animal Handling) check to control your mount when you attempt a risky maneuver.
Your DM could pick an appropriate stat block from Appendix D of the Player's Handbook to represent the creature, or the DM might let you make that choice yourself with their approval. Your DM may require an expense of time and money by your character to acquire the creature or at least an appropriate backstory to justify your accompaniment by the creature.
Regardless, the creature itself would likely be under the control of your DM as if it were a Non-Player Character rather than directly under your control. Your DM would decide (by calling for the aforementioned skill checks or by making their own judgement calls) what actions the creature actually takes when you attempt to direct it.