This use of "logging" comes from the "logbook", a book recording what happened on a ship, which was called that because a literal log (i.e. part of a tree) attached to a rope was used to measure the ship's speed.
See:
https://en.wikipedia.org/wiki/Chip_log
https://en.wikipedia.org/wiki/Logbook_(nautical)
In the modern computing context, "logging in" does involve adding entries to a kind of (digital) record-keeping tool.