I hope you're having a good day so far. You can make classes inactive, which means they won't count towards your total class count. The steps below will guide you on how:
Go to the Gear icon and select All Lists.
Check the classes you need to make inactive and press Batch Actions.
Hit Make Inactive and push Yes when the message box appears.
Now your classes will be out of view, and you'll be able to add more toward your class total. You may find this article about creating and managing classes helpful as well. As for the randomly added classes, I suggest checking your Audit Log to see if QuickBooks is adding them for you or if you created them when you created an Invoice.
I'm only a post away if you have any other questions. Enjoy the rest of your day!