1520s, "distorted, somewhat twisted to one side," from obsolete verb wry "to contort, to twist or turn," from Old English wrigian "to turn, bend, move, go," from Proto-Germanic *wrig- (source also of Old Frisian wrigia "to bend," Middle Low German wrich "turned, twisted"), from PIE *wreik- "to turn" (source also of Greek rhoikos "crooked," Lithuanian raišas "lame, limping"), from root *wer- (2) "to turn, bend." Of words, thoughts, etc., from 1590s. The original sense is preserved in awry.
-ly 2
common adverbial suffix, forming from adjectives adverbs signifying "in a manner denoted by" the adjective, Middle English, from Old English -lice, from Proto-Germanic *-liko- (cognates: Old Frisian -like, Old Saxon -liko, Dutch -lijk, Old High German -licho, German -lich, Old Norse -liga, Gothic -leiko); see -ly (1). Cognate with lich, and identical with like (adj.).
Weekley notes as "curious" that Germanic uses a word essentially meaning "body" for the adverbial formation, while Romanic uses one meaning "mind" (as in French constamment from Latin constanti mente). The modern English form emerged in late Middle English, probably from influence of Old Norse -liga.