The verbs hikir הכיר - "to recognize" and hitnaker התנכר - "to act like a stranger" both stem from the same root : נכר . We find both forms in Bereshit 42:7:
וַיַּרְא יוֹסֵף אֶת-אֶחָיו, וַיַּכִּרֵם; וַיִּתְנַכֵּר אֲלֵיהֶם
"When Yosef saw his brothers, he recognized them, but acted like a stranger to them"
How did one root come up with apparently opposite meanings?
Almagor-Ramon writes that in other Semitic languages the root נכר means a stranger - as in the word nochri נוכרי, for example. Only in Hebrew did a sense develop of recognition - hakara הכרה . This would indicate that the meaning of "stranger" was earlier, and indeed Klein writes that "the original meaning of נכר would have been 'to regard as something strange' i.e. 'to regard intently'."
Almagor-Ramon also points out the similarity here to the example of host and hostile - opposite meanings from a common root. In both cases, we have an initial perception of another - which can turn out to be positive or negative.