Old English fæst concerned firmness and security. Fast later came to describe rapid movement, and could then describe a clock showing a time ahead of the correct one. The fixed sense still survives in expressions such as held fast.
Sources
- Etymonline: fast
The adjective history gives fixed/secure fæst, rapid fast and a later clock use; the linked adverb discussion offers competing semantic explanations.
- Merriam-Webster: fast
The edited clock sense concerns a time ahead of the correct time.