Solution 1:

Disenroll, "To cancel enrolment; to remove oneself from a list" may be the word you want.

It is in common use, for example as a bit of legal jargon for leaving an insurance plan:

A member may only disenroll from an MA plan during one of the four election periods noted above. ... When the date of death is unknown, the carrier may take action to disenroll the individual on the date...

Solution 2:

If you are talking about what to do after you enroll in a class, but want to not be enrolled anymore, then you would

withdraw

from it.

Solution 3:

Enroll can also be used passively/transitively, e.g. you can be enrolled onto a medical register- in which sense the antonym could be "strike off".