After school, I go to an afterschool class to study math.

(Is this a correct sentence? Do you ahve better expressions?)

Since you've used "after school" twice, this would be better:

After school I go to a math class.

or:

I take an after-school math class.

Thank you.

Then can we say:
My favorite class is a math class.

Yes, we can say that.

However, as I said before, it's more common to say: My favorite class is math class.

However, if you are taking two math classes, it's more accurate to say which math class is your favorite.

Example: My favorite class is algebra.

Yes, your sentence is grammatically correct. However, if you're looking for alternative expressions, here are a few options:

1. "I attend an afterschool math class."
2. "I take part in a math study program after school."
3. "After school, I go to a class where I focus on math."

Remember, the choice of expression depends on your personal preference and the context in which you are using it.