prefix of reversal, deprivation, or removal (as in unhand, undo, unbutton), Old English on-, un-, from Proto-Germanic *andi- (source also of Old Saxon ant-, Old Norse and-, Dutch ont-, Old High German ant-, German ent-, Gothic and- "against"), from PIE *anti "facing opposite, near, in front of, before, against" (from PIE root *ant- "front, forehead," with derivatives meaning "in front of, before").
More or less confused with un- (1) through similarity in the notions of "negation" and "reversal;" an adjective such as unlocked might represent "not locked" (un- (1)) or the past tense of unlock (un- (2)).
Old English fæstnian "make fast, make firm, fix, secure," also "ratify, betroth, confirm," from Proto-Germanic *fastinon "to make firm or fast" (source also of Old Frisian festnia "to make firm, bind fast," Old Saxon fastnon, Old High German fastnion, German festnen, Old Norse fastna "to pledge, betroth"), from PIE *fast "solid, firm" (see fast (adj.)). Related: Fastened; fastening.
<a href="https://www.etymonline.com/word/unfasten">Etymology of unfasten by etymonline</a>
Harper, D. (n.d.). Etymology of unfasten. Online Etymology Dictionary. Retrieved $(datetime), from https://www.etymonline.com/word/unfasten