In general, never trust words in the English language to be phonetic! This is largely a consequence of English being such a fast-evolving language, and importantly, owing its vocabulary to many linguistic sources: Latin, Old French, Anglo-Saxon (a.k.a. Old English), Norse, and many others.
In this case it seems we have French to thank. This etymology is given online, and explains the supposed strange pronunciation:
debt
late 13c., dette, from O.Fr. dete, from L. debitum “thing owed”, neut. pp. of debere “to owe”, originally, “keep something away from someone”, from de- “away” (see de-) + habere “to have” (see habit). Restored spelling after c.1400.
In other words, debt comes via the Old French dete, which itself derives from classical Latin debitum. The b sound got lost due to French phonological rules/convention, and hence the French-origin pronunciation in English. Evidently, after the end of the Middle Ages in the 15th century, there was much revived interest in the classical world, and the spelling reverted to include the original b. Pronunciation, of course, stayed the same.
(Note that this sort of evolution occurred with many different English words, and occurred at the same time many new Latin words entered the English language.)
I have actually heard someone pronounce the /w/, and not facetiously. It must be rather rare, though, and I might say it's a hypercorrection. In any case, my guess is that [wɔ] and [wo] have a tendency to become [ɔː] and [oʊ] in the neighbourhood of consonants such as [s] that don't change much in the presence of labialisation. The matter is complicated a bit by the spread of non-rhotic accents.
The original word was /sweord/, which according to the usual Old English reconstructed pronunciation would be [sweort] or [sweʊrt]. I imagine [eʊ] dropped to [əʊ] or [əu], which is an allophone of [o]. By this time the [w] had become vestigial and was ultimately dropped, but English spelling is far more conservative than its pronunciation, so the /w/ was retained.
Best Answer
A few sources indicate it's due to initial confusion between coco, cocoa, and cocao.
According to Dictionary.com, the confusion started circa 1545 when cocao was misspelled as cocoa.
But, according to the Online Etymology Dictionary, the pronunciation issue occurred with the 1707 printing of Johnson's Dictionary that ran coco next to cocoa, stirring confusion between the two words.