“Long time no see” comes from the Chinese phrase, “????????????” (h??o ji?? bù jiàn) which literally means ??? (good or very) ??? (long, as in length of time) ??? (no) ??? (see). So you get: For a good long time, we haven’t seen each other.
Or, to say it more succinctly: Long time, no see.
This phrase first started evolving into the lingua franca for English speakers in the 19th/20th century, when Chinese immigrants created a kind of Pidgin English and for some reason, English speakers latched on to this particular nugget and decided to run with it.