this is just an awkward sentence to translate. Grammatically, it is correct, but it sounds weird to a native English speaker, because it is commonly said like "me and my friend".
"me and my friend like mathematics" is grammatically incorrect, although acceptable in spoken English. It is incorrect because if the words "and my friend" was removed from the sentence, it would read "me like mathematics", which is wrong.
It is "I like mathematics", because "I" is first person active voice and "me" is first person passive voice, and the sentence is written in active voice. So we need to use the active voice first person pronoun, "I", in this sentence structure.
So the translation is correct, but not commonly heard in spoken English. It is more common to hear/read "my friend and I like mathematics".
Yeah, "me and my friend like mathematics" is not grammatically correct because it puts a pronoun which is not in nominative case into the subject of the sentence. Only nominative-case pronouns should be part of an English sentence's subject (i.e. I; you; he, she, it; one; they). Doesn't stop people from doing it informally anyway, but it's not actually good English.
Pronouns are the only part of speech that retain a case system in the English language, and this has an effect on where in the sentence they can be used.