The story
Knee is one of the oldest words in English. Old English cnēow comes down from a root that Indo-European languages share widely: the same ancestor gives Latin genū (hence genuflect, "bend the knee"), Greek góny and Sanskrit jānu. Closer to home, German Knie, Dutch knie and Swedish knä are all the same word.
In Old English and Middle English the K was pronounced, firmly, in front of the N — as it still is in German and Dutch, where Knie begins with a clear "k-n". English speakers simplified the cluster: in educated speech the kn- became plain N during the 1600s.
By then the spelling knee was long established in manuscripts and print, so the K stayed on the page. It is now one of a whole family of silent Ks — know, knife, knight, knock, knot — all of which lost the sound at around the same time.
