To hide courses from view that you are no longer enrolled in, access to these changes will be through the dashboard, instead of the current Moodle homepage. To get there, you can go to your profile in the upper right hand corner and select dashboard from the drop-down menu.
Once there, select “Customize Page” from the upper right hand corner as well.
From there, using the arrows, click and drag the courses you’re currently enrolled in to the top of the list.
Once the courses are in the correct order, click the drop-down menu above the list and select the number of courses to display that matches the number you’re currently enrolled in.
Once that number is selected, that should be how many are shown in your dashboard. If you want to see all of them, just select “show all courses” at the bottom of the course overview.