Capabilities/enrol/manual:unenrolself
From MoodleDocs
- This allows a user to manually unenrol themselves from a course in Settings > Course administration > Users > Enrolled users
- This capability is not set for any of the default roles
- To allow students to unenrol themselves from courses they are in, the capability must be set to "allow" for the student role via Settings>Site Administration>Users>Define roles.