If you are a teacher in a course:
- Go to Settings > Course administration > Users > Enrolment methods.
- Disable (close the eye) of the self-enrolment option.
If you are site admin:
- Go to Settings > Site administration > Plugins > Enrolments > Manage enrol plugins.
- Disable (close the eye) of the self enrolment plugin.