When you are assigned a goal and you enroll in the related courses or your portal administrator has the LMS automatically enroll you in goal-assigned courses, if the ad hoc or rule-based goal is deleted, any enrollments that already exist because of that goal are NOT removed or cancelled automatically.
As a student, if you are certain the goal is deleted or in the case of a goal rule, it will never run again, you can cancel your enrollments in the relevant courses to get them off your Courses to Complete.
As an administrator, you can cancel enrollments in the following ways: