Why do we say...

Think it's down to common or garden facetiousness! Or mock surprise that it isn't somebody else (nicer, better).

This line from the page link following gets pretty near:

Why the negation?

As each of the dictionary authors observes, the negation of the expected "Look who it is" serves to render the expression facetious: whereas "look who it is" can (depending on intonation) suggest pleasant surprise on the speaker's part, "look who it isn't" (taken at face value) indicates disappointment that whoever it is isn't someone else. From this reversal of implication arises the term's facetiousness when the encounter is in fact one that the speaker welcomes.

More here for those still awake