Concept:Question words have different jobs:
what asks about a thing,
which asks for a choice,
who asks about a person, and
how asks about the way or method something was done.
Solution:The sentence already names the thing found out ("my name"), so the stranger is not asking what was found.
He wants to know the way I came to know his name: "
How did you find out my name?"
A: "What did you find out my name?" has two objects (what + my name), so it is wrong.
B: "Which" needs a choice between things; there is none here.
C: "Who" asks about a person; the subject "you" is already given.
So the correct question word is "how".
Answer:Option D (how)