The name of a class is capitalized when you're using it as the name of a class. If the name of a class is a common word or phrase, when you're using it to refer to something other than the class, it would not be capitalized.
Examples:
I stopped studying math after high school. I got as far as calculus.
Professor Leibniz teaches Calculus I, Calculus II and Discrete Mathematics.
American history is my favorite subject.
American History, with Professor Clarke, is my favorite class.
Note: these kinds of sentences can be ambiguous when spoken, but when written, the capitalization can make the meaning clear.
I hate multivariate statistics (the subject)
I hate Multivariate Statistics (a specific class)