I am so confused with the cases when constructing this sentence in Russian. I tried to construct it in 2 ways. I really don't know whether they are right or wrong. If wrong, what are my errors? I did my best to explain the problem in the picture:
You are almost perfect in your investigation.
Я иду на вечеринку к своему другу. (к кому? – dative, на что? – accusative)
All cases are used correctly. Mind the possessive pronoun.
Я иду на вечеринку своего друга. (на что? – accusative, кого? –своего друга – genitive ). Possessive case is Genitive.
The first is more natural, though.
Я иду на вечеринку моего друга
Not sure why you're so confused. Word order doesn't matter here, so "на вечеринку" must be in Accusative just like in the first example.
Both variants are OK, although the first one is slightly more natural IMO. Also note that it's often a good idea to say "своему / своего" instead of "моему / моего", i.e. "Я иду на вечеринку к своему другу".