The use of the verb '먹다' in Korean is very unique and many of them are derived from metaphor. If you eat something through your mouth,
(1) It is gone. You can't find it again.
잊어 먹다: It means to forget, but sounds stronger and more emphatic than 잊다. It's a metaphor from to forget and eat.
까먹다: It also means to forget, but sounds more emphatic and vulgar or colloquial than 잊다. It's a metaphor from to peel (open) and eat.
(2) turn something good and tasty into excretion (bad thing).
해 먹다: It means to steal. It is slang and it's a metaphor from to do and eat. For example, 공금을 해 먹다. To steal or embezzle a public fund.
말아 먹다: It means to fail completely. It is slang and it's a metaphor from to roll (or mix) and eat. For example, 사업을 말아 먹다. To fail or go bankrupt in one's business. However, you need to note that 밥을 국에 말아 먹다 means to mix (put) your rice with (into) your soup and eat. It doesn't have any slangy meaning.
(3) your mouth or throat is full or blocked.
귀먹다: It means to go deaf. It doesn't mean to eat ear.
코먹다: It means your nose is blocked. It doesn't mean to eat nose and it is more broadly used as an adjective. For example, 코먹은 소리 means a nasal sound (twang).
(4) you are satisfied.
이용해 먹다: It means to take advantage of people to your advantage (satisfaction). It's a metaphor from to use and eat.
시켜 먹다: It means to order someone to do something for you to your advantage (satisfaction). It's metaphor from to order and eat.
Is it true that -먹다 can be used to show that you did something bad?
No, it could be used for situations you did something good and bad. It depends on your position.
What's the origin of this meaning?
It's extremely difficult to find the origin of Korean words. The first consonant 'ㅁ (미음)' in 먹다 seems to have come from the Chinese character 口 (입 구) which symbolizes a mouth. But as I explained above, most of those expressions are compound verbs (another verb or noun + 먹다) that represent metaphor.
You need to note that there are many more expressions that have 'another word + 먹다' construction and you have to learn it on a case-by-case basis. But, I don't think they will be too much different from the explanations given above.