1. I studied math for 10 years, but I'm still not good at it.

2. I have studied for 10 years, but I'm still not good at it.

(Which one is grammatical? Do we have to sue the present tense or the present perfect tense here?)

I think #2 is better. The "still" implies that the study is continuing, rather than having been finished in the past.

#1 would be ok if it said something like

I studied math for ten years, but never really learned it.

#1 is still ok as it is, if you are discussing past activities, and are just saying that your ten years of study were wasted, because you are still not good at math. The meaning of "still" is different; it means "nevertheless" rather than a continuing activity.