Basically, when you purchase something with a credit card the bank fronts the money to the merchant and bills you for purchases later. If a transaction is fraudulent, either the merchant or the credit card company take the hit, and you're never out any money, even temporarily. For credit cards the market has settled on 0 consumer fraud liability pretty much no matter the circumstances (and very hassle-free too).
On the other hand, with debit cards money is withdrawn from your account when a fraudulent purchase is made, and you need to wait for your bank to complete an investigation to reimburse you. They also tend to have rather stricter reporting standards in that if you don't report fraud promptly, you might be stuck with (some) liability.
Either way you'll typically get your money back, but the hassle is much reduced with credit cards.
The US (and Canada) have much weaker consumer protections for debit than credit.
If a merchant posts a fraudulent transaction against a credit card, you'll most likely get your money back. If a merchant posts a fraudulent transaction against a debit card, you might not get your money back.
More dangerously, if your debit card credentials are skimmed and used to withdraw money from your account by any means other than the retail debit-card payment system, you won't get your money back.