Mmm... I think I'd have to ask a pro about that one, because I use it so much I just don't think about it anymore. Venturing a guess, I'd say it's a twist on the "na no da"/"na no desu" phrasing, which is redundant, but sometimes used for emphasis. It's mainly used informally in conversational situations, though, and the "da" is often cut out, in which case it sounds better to say na no, instead of nan. "nan" would be the contracted form of "na no". In the present tense "Sensei nan da", in the past tense "Sensei nan datta". (Of course, da is just short for desu, that at least, I'm sure of).