Debit and credit?

In general if we pay someone we say the money has been debited from our account and vice versa for credit. I couldn't understand how debit is money coming in and credit money going out?