You have to install Homebrew using Rosetta, this way:
To install Homebrew on a mac with M1 chip you have to open the terminal
using Rosetta (right click on the Terminal icon and check the
"open using Rosetta" option) then run
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"