By default MacOS/Xcode use clang, not gcc. If you have a project needs to build using gcc, you can integrate the project into Xcode by using external build system.
Before start, you need to install gcc first. To do that, use brew, the recommended package manager on MacOS platform. Get brew installed by following their instructions.
Then install gcc using these commands:
brew info gcc
brew install gcc
The gcc application will be installed by default in /usr/local/bin.