From the official documentation:
Android Studio projects contain a top-level project Gradle build file that allows you to add the configuration options common to all application modules in the project. Each application module also has its own build.gradle
file for build settings specific to that module.

Project Build File
<PROJECT_ROOT>\build.gradle
or the Project Build File is for the entire project, so it will be used for global project configurations.
A typical Project Build File contains the following:
- buildscript which defines:
- repositories and
- dependencies
- Gradle Plugin version
By default, the project-level Gradle file uses buildscript to define the Gradle repositories and dependencies. This allows different projects to use different Gradle versions. Supported repositories include JCenter, Maven Central, or Ivy. This example declares that the build script uses the JCenter repository and a classpath dependency artifact that contains the Android plugin for Gradle version 1.0.1.
Module Build File
<PROJECT_ROOT>\app\build.gradle
or the Module Build File is for a specific module so it will be used for specific module level configurations.
A Module Build File contains the following:
- android settings
- compileSdkVersion
- buildToolsVersion
- defaultConfig and productFlavors
- manifest properties such as applicationId, minSdkVersion, targetSdkVersion, and test information
- buildTypes
- build properties such as debuggable, ProGuard enabling, debug signing, version name suffix and testinformation
- dependencies
You can read the official documentation here:
Projects and modules build settings