"Liter" comes from the Latin word littera, meaning "letter".
Over time, the word "liter" evolved to refer to "letters" as a whole, and then to "written language" or "literature". This eventually led to the word "literal", meaning "according to the letter", and "literally", which means "in a literal sense" or "exactly".