1660s, "inadequacy;" 1716, "want of skill," from or modeled on French incompétence (16c.), from in- "not, opposite of, without" (see in- (1)) + compétence (see competence). Native formation incompetency is older (1610s).
word-forming element meaning "not, opposite of, without" (also im-, il-, ir- by assimilation of -n- with following consonant, a tendency which began in later Latin), from Latin in- "not," cognate with Greek an-, Old English un-, all from PIE root *ne- "not."
In Old French and Middle English often en-, but most of these forms have not survived in Modern English, and the few that do (enemy, for instance) no longer are felt as negative. The rule of thumb in English has been to use in- with obviously Latin elements, un- with native or nativized ones.
1590s, "rivalry" (based on compete), also "adequate supply," both senses now obsolete; 1630s as "sufficiency of means for living at ease," from French compétence, from Latin competentia "meeting together, agreement, symmetry," from competens, present participle of competere, especially in its earlier sense of "fall together, come together, be convenient or fitting" (see compete).
Meaning "adequate range of capacity or ability, sufficiency to deal with what is at hand" is from 1790. Legal sense "capability or fitness to be heard in court" is from 1708.