Why is clase a feminine noun? Usually nouns ending with -a are feminine right?
I don't know exactly why but like many other languages, it's all about etymology (roots/origin(s) of the word) and usage. And as you said yourself nouns ending with -a are usually feminine. Keyword: usually. In other words, not all nouns ending with -a are feminine and not all feminine nouns end with -a.
masculine: un/el clima, problema, día
feminine: una/la canción, universidad, nube
If the modifier is a noun, the article "de" is used..
a physics class - una clase de física
But if it's an adjective, the article is not used..
an important class - una clase importante
Nouns go before adjectives and clase is a feminine noun so you use 'una' instead of the masculine 'un'.