c. 1300, "relation by marriage" (as opposed to consanguinity), from Old French afinite "relationship, kinship; neighborhood, vicinity" (12c., Modern French affinité), from Latin affinitatem (nominative affinitas) "relationship by marriage; neighborhood," noun of state from affinis "adjoining, adjacent," also "kin by marriage," literally "bordering on," from ad "to" (see ad-) + finis "a border, a boundary" (see finish (v.)).
Spelling was re-Latinized in early Modern English. Used figuratively in English since c. 1600 of structural relationships in chemistry, philology, geometry, etc. Meaning "natural liking or attraction, a relationship as close as family between persons not related by blood" is from 1610s.