In the sidebar, click the Drop this Course button.
Note: You can only drop a self-enrolled Canvas course while it is in progress (between the course start date and end date). Also, if you did not enroll in the course using the given URL or join code, meaning you were manually or automatically added to the course, you will have to ask your teacher or institution to be removed from the course.