It comes from the verb "transire" which means "to go across" or "to pass over".
Here's how the word has evolved:
* transire (verb)
* transitus (noun)
* transit (English noun)
So, "transit" literally means "the act of going across" or "the passage".