Middle English dette: from Old French, based on Latin debitum 'something owed', past participle of debere 'owe'. The spelling change in French and English was by association with the Latin word.
MORE
This comes via Old French from Latin debitum ‘something owed’, the past participle of debere ‘owe’. Debit (Late Middle English) is from the same source.