"detergent substance," 1670s, from detergent (adj.). Originally a medical term; application to "chemical cleansing product" is by 1932.
"cleansing, purging," 1610s, from Latin detergentem (nominative detergens), present participle of detergere "to wipe away, cleanse," from de "off, away" (see de-) + tergere "to rub, polish, wipe," which is of uncertain origin. Originally a medical term.
The substance formerly was used in place of soap, hence Old High German luhhen "to wash," Old Norse laug "hot bath, hot spring," Danish lørdag, Swedish lördag "Saturday," literally "washing-day," "the day appropriated by the Scandinavians to that exercise" [Century Dictionary]. Chamber-lye in early Modern English was the name for urine used as a detergent.