`$ brew leaves`

[Docs][1]:

> List installed formulae that are not dependencies of another installed formula.

You can also use `--installed-on-request` or `--installed-as-dependency` to understand the reason a package was installed. 

  [1]: https://docs.brew.sh/Manpage#leaves