mid-14c., "having a defect or flaw of any kind, inferior, in bad condition," from Old French défectif (14c.) and directly from Late Latin defectivus "imperfect," from defect-, past-participle stem of deficere "to desert, revolt, fail," from de "down, away" (see de-) + combining form of facere "to do, make" (from PIE root *dhe- "to set, put").
[D]efective generally takes the sense of lacking some important or essential quality; deficient, that of lacking in quantity: as defective teeth, timber, character; deficient supplies, means, intellect. The same difference is found between deficiency and defectiveness. [Century Dictionary]
In grammar, "wanting some of the usual forms of declension or conjugation" (late 15c.). Used in the sense of "mentally ill" from 1854 to c. 1935; as a noun, "person wanting in some physical or mental power," by 1869. Related: Defectively; defectiveness.