I had the same question on my mind so I goog'ed them both.
The prefix de- is the same which means away from in Latin.
The endings however are different but loosely related. tergere means to wipe, making detergent's meaning- to wipe away from;
While terrere means to frighten, making deter's meaning- to frighten away from, also Latin in origins.
Hope this answers your curiosity, but seeing the date of the posting now, I think you have moved on with your life.