This is usually fixed by reordering directories in PATH to make MSYS2 be first. In the (non-msys2) terminal, run
echo $env:PATH
to print the PATH and confirm that MSYS2 is first.