Terminal "history" command brings back different results
In other words, Terminal.app connects you to a certain shell, allowing you to access all sorts of them concurrently.
Run cat /etc/shells to see what shells are on your system.
I’m sure you’ve got Bash, ZSH, and a few others.
Then read up on configuring the history for your chosen shell, and try to make it a habit to always know which shell you’re using.
The fish shell, for instance, has an extensive and user friendly history browser, allowing you to see all commands you’ve run using fish.
With bash it’s a bit different.
Also Mac specific:
If you have apps that run maintenance and require administrative privileges, they likely run some of their tasks as simple shell scripts, and almost always using sh.
Think: Catalina Cache Cleaner, Cocktail and Onyx, to name a few.