Old English wis "learned, sagacious, cunning; sane; prudent, discreet; experienced; having the power of discerning and judging rightly," from Proto-Germanic *wissaz (source also of Old Saxon, Old Frisian wis, Old Norse viss, Dutch wijs, German weise "wise"), from past-participle adjective *wittos of PIE root *weid- "to see" (hence "to know"). Modern slang meaning "aware, cunning" first attested 1896. Related to the source of Old English witan "to know, wit."
A wise man has no extensive knowledge; He who has extensive knowledge is not a wise man. [Lao-tzu, "Tao te Ching," c. 550 B.C.E.]
Wise man was in Old English. Wise guy is attested from 1896, American English; wise-ass (n.) by 1966, American English (probably a literal sense is intended by the phrase in the 1607 comedy "Westward Hoe" by Dekker and Webster). Wisenheimer, with mock German or Yiddish surname suffix, first recorded 1904.
-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.