This might indicate a clash of a general Gradle plugin with some specific plugins that you have in your config. I has this problem when my default Gradle plugin was very modern - 8.4
You need to investigate your root plugins (root build.gradle) - here you can read a version for Kotlin compiler and a android gradle plugin (the AGP):
classpath 'com.android.tools.build:gradle:7.2.1' // AGP
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21" // Kotlin compiler
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.4.1'
classpath 'de.undercouch:gradle-download-task:4.1.2'
Next, go to your Module Settings (usually for the :app module) and check your Gradle plugin version:

Now, here is what a little inference should follow:
I use Kotlin 1.5.21. It was released around mid-2021, and around that time some commonly used versions of AGP were between 4.0.x to 4.2.x that would typically be compatible with Gradle versions 6.1.1 to 6.7.1.

So for my case I had to try with version 6.1.1+, 6.5+ and 6.7.1. After trying 6.7.1 it compiled and suggested bumping version to 7.3.3, which I did.
So the general approach towards this problem goes like this:
- Find Kotlin Gradle plugin version in Your
root.gradle file.
- Find corresponding AGP plugin versions that are compatible with the Kotlin one by looking at release dates (Use Kotlin releases page and Maven page).
- Find the compatible Gradle plugin version that matches found AGP plugin versions (Use Android documentation reference table).