Can the King be attacked by a pinned piece? A computer chess game does not permit moving the white King to d2 presumably because it's attacked by the black Knight which I suspect is correct, but the Knight can't actually attack that square because that would put it's King in check.

So, is the game correct?  Is Kd2 illegal?

[FEN "8/8/4k3/8/4n3/8/8/3KQ3 w - - 0 5"]
Kd2 is indeed illegal. You can think of it this way: normally Black can't move his knight because White would "capture his king", but if White were able to play Kd2 then Black would capture White's king before White got a chance to capture his.