1520s, "irreligious, not god-fearing, not in accordance with the laws of God," from un- (1) "not" + past participle of godly (adj.). Cf. Middle Dutch ongodelijc, German ungöttlich, Middle Swedish ogudhlik. Colloquial sense of "outrageous, dreadful" is recorded from 1887.