First of all, Welcome to Fishlore! It is great to see you around! Now onto the question you asked.
Personally, I do not recommend putting any fish other than a Betta in a 5 gallon tank. The reason for that is that most small fish that you think may be compatible for a small setup will require the presence of more of their own kind. However, don't give up hope just yet, there are other interesting things you can put into a 5 gallon tank.
Shrimp: This makes a great and fun tank setup that I 100% recommend. Shrimp have much lower bioloads than fish, meaning that more of them can be kept in smaller confines. Neocardinia shrimp such as Cherry Shrimp will look stunning in your tank with their bright colors and interesting social behaviors. However, something to note with any shrimp is that they do much better in the presence of live plants. This is because biofilm will grow on the plant leaves, a
prime food source for Cherries (or other shrimp)! Live plants are much easier to grow than you may think, so feel free to look around here on Fishlore if you have any questions or create another thread if you are curious on this aspect. If you are not feeling confident with ornamental shrimp just yet, trying feeder shrimp like
Ghost Shrimp may also be a viable option for you to consider as well.
Snails: Yup, the organism that many people needlessly hate on. I personally love to have snails in all my tanks as they aid in breaking down decaying plants and detritus. They are like miniature landscapers in your tank! However, for a 5 gallon tank I would recommend a single Nerite Snail with the Betta or Shrimp (Avoid
Mystery Snails, they grow much too large for a 5 gallon tank and there are reports of Bettas eating the tentacles on these snails). The Nerite Snail requires brackish water to reproduce, meaning they won't overpopulate your small space provided. They also are regarded as one of the best algae eaters around and are attractive to boot, many wins in one!
All in all, my own stocking recommendations for a 5 gallon tank are as follows;
1 Betta, 1 Nerite Snail
or
5-6 Cherry Shrimp (may reproduce rapidly with males and females, keep that in mind), 1 Nerite Snail