It is correct to say you feel bad when you are expressing an emotion. To say, “I feel badly,” implies that there's something wrong with your sense of touch. Every time I hear people say, “I feel badly,” I imagine them in a dark room having trouble feeling their way around with numb fingers.
That's because badly is an adverb, meaning that it modifies a verb. So when you say, “I feel badly,” the adverb badly relates to the verb feel. Since feel means "to touch things," feeling badly means you're having trouble touching things.
Few people pointed out that people wouldn't say they feel madly or they feel sadly, and they wondered why so many people say they feel badly? Fowler's Modern English Usage notes that it's only appropriate to use bad instead of badly after the verb feel. But other sources say this is true of all verbs that describe senses, such as taste and smell. For example, “I smell bad” and “I smell badly” have completely different meanings! When you say, “I smell badly,” badly is an adverb that modifies the verb smell. You're saying your sniffer isn't working, just like when you say you feel badly you're saying that your fingers aren't working. When you say, “I smell bad,” bad is an adjective, which means it modifies a noun. You're saying that you stink, just like when you say “I feel bad” you're saying that you are regretful or sad or ill or wicked.
But getting back to the previous question, the reason people often think they should say they feel badly is that after most other verbs it's correct to use the adverb. For example, if you gave a horrible speech you might say, “It went badly.” If a child threw a fit in a shopping mall, it would be correct to say, “She behaved badly.”