@tjluoma has the right of it. Software is largely the same whether you install it from the command line or the Mac App Store. Homebrew as a distribution mechanism is perfectly safe and open source.
However anyone can ask you to brew install
something. Only do so if you trust the software itself or if you trust the person telling you to install the software.
The intuition is similar as if you might be averse to install software from google if you don’t trust google.