This is about sequencing events in the past. The sequence is 1) I knew him, then 2) I came here.
We can use the past perfect tense (had known) to establish that the knowing was first. But in each sentence there is another word that sequences the events: already and before. Because of those words, the simple past tense also works.
So you can say:
I already knew him when I came here.
I had already known him when I came here.
Before coming here, I knew him.
Before coming here, I had already known him.
Student or Learner