I came across the idiom "be first in Maths". But I couldn't find any with other school subjects. Is it possible to say "be first in Geography/Physics"? Or the preposition "in" goes only whith Maths? When did this idiom "be first in Maths" come to be?
In this situation, "Maths" is referring to the group (i.e. Maths class), not the subject of the lesson.
You can be first in the group - first in Maths.
You can be the best at the subject - best at Maths.
You can also be the best in the group - best in Maths.
But you can't be the first at the subject - first at Maths. X
The same rules apply for other classes/subjects.
At first I thought you were right, but after that I realised that it was "first", not "good".
We do not say "be first in/at" but we say "be first for".
Definition of "for" by Dictionary.com
with the object or purpose of
e.g. to run for exercise.
be first [with what? Math.] for Math
Nevertheless, it is still possible to use in/at for similar cases.
be good at Math
your Math is good
be good in Math
you are good in Math (class/lesson)