mid-13c., uglike "frightful or horrible in appearance," from a Scandinavian source, such as Old Norse uggligr "dreadful, fearful," from uggr "fear, apprehension, dread" (perhaps related to agg "strife, hate") + -ligr "-like" (see -ly (1)). Meaning softened to "very unpleasant to look at" late 14c. Extended sense of "morally offensive" is attested from c. 1300; that of "ill-tempered" is from 1680s.
Among words for this concept, ugly is unusual in being formed from a root for "fear, dread." More common is a compound meaning "ill-shaped" (such as Greek dyseides, Latin deformis, Irish dochrud, Sanskrit ku-rupa). Another Germanic group has a root sense of "hate, sorrow" (see loath). Ugly duckling (1877) is from the story by Hans Christian Andersen, first translated from Danish to English 1846. Ugly American "U.S. citizen who behaves offensively abroad" is first recorded 1958 as a book title.