Japanese relative clauses are much simpler than the English equivalent, in that they do not specify the grammatical role of the modified noun using relative pronouns such as "where". They work by changing the word order and removing the particle in the original sentence. Therefore, a Japanese relative clause can sometimes result in an ambiguous expression, and you may have to determine the true meaning by the context.
Let's start from these plain sentences:
- A1) 私は その人が 好きだ。 I like that person.
- B1) その人は 私が 好きだ。 That person likes me.
I hope these are easy enough to you. They obviously have different meanings. Next, let's construct relative clauses from these using this rule. But let's pull out the same word, (その)人 for both cases. As a rule, は in a relative clause turns to が, and だ/です becomes な:
- A2) [ 私が __ 好きな] 人 the person who I like
- B2) [ __ 私が 好きな] 人 the person who likes me
See how the particle after 人 was removed. Now A2 and B2 suddenly look identical! This is why 私が好きな人 is ambiguous.
Related:
Note: 私は猫がすき is actually ambiguous, at least theoretically, and it can mean "It's the cat that likes me" in a certain rare context (see this comment). This is due to the fact that は also has a contrastive function and が also has a exhaustive-listing function, but beginners may forget this fact for now.