As you probably know, there are differences between (1) the native terminology used by educated native-English speakers to talk about English, (2) the terminology used to teach English to speakers of other languages, and (3) the terms actual linguists use to talk about English. There is substantial overlap between the three communities, but there are many areas of confusion.
The term "phrase" in ordinary English is used to mean any groups of words that together convey a single thought. It also has a more technical meaning in the three communities described above, but is probably not well understood except by linguists.
English speakers tend to learn the word "clause" in school, but it is only a technical word, and many people do not really understand what it means.
My opinion is that in the best technical usage for all three communities, a "phrase" refers to a group of words that is used grammatically in the same way a single word could be used and a "clause" refers to any expression that includes a 'subject" and a "predicate," whether or not that expression can be used independently of other words or is grammatically subordinate to other words. There is still some imprecision about some areas of grammar, such as with infinitives, but generally the usages are distinct.
The group of words "wanting to get good marks" is best called a participial phrase, since it does not include a subject. Your question concerns what reference is made or could be made by the word "wanting" in your example sentence.
In general, it is common for participial phrases to refer to subjects (e.g., "my friends stayed at home completing their homework"); however, it is also quite common for participial phrases to refer to the object of the sentence (e.g., "I saw my friends at home completing their homework"). Generally, usage is clear about which reference is correct, but depends upon the construction. Good writing will always make this clear, but many native-speakers are not good writers and often make what are formally thought to be mistakes, such as using dangling participles (e.g., "*Walking down the street, many of the flower trees seemed really beautiful to me.") .
Yesterday, I had to go the party on my own because my friends stayed
at home completing their homework, wanting to get good marks.
Sentences such as this one use advanced phrasing that are tricky to use and often require the commas to be used very precisely. By using the comma before "wanting to get good marks" you express that the phrase applies to the subject "I" and does not apply to the "friends." This usage is awkward, however, because so much material intervenes between "I" and "wanting." (It is also doesn't make sense to say that partying is what you do if you want to get good marks, but I am talking about the literal meaning here.) To make a participial phrase refer to the subject, you need to place it closer to the subject or to the related verb. E.g., "I left my friends studying and went to the party anyway, thinking there was still enough time to study afterward."
In order to apply to the "friends," the comma should not be used (i.e., "I had to go ...because my friends stayed at home completing their homework wanting to get good marks." This sentence, however, is still awkward for two reasons: (1) relying only on the comma to distinguish the meanings is risky and still somewhat ambiguous and (2) putting two similar participial phrases in a row is awkward. It would be better to rewrite this meaning as: "I had to go...because my friends stayed at home completing their homework and trying to get good marks" or as "I had to go...because my friends stayed at home completing their homework to get good marks."