Here is an abridged and very freely adapted version of a more comprehensive posting that is available in its entirety in the Archives, under "Bad vs. badly."
Bad is an adjective, to be used after forms of the verb be and other linking verbs, such as become, seem, appear, and feel-"”when feel acts as a linking verb. Linking verbs serve to connect a descriptive word, an adjective, to its subject:
1) I was so happy, knowing that my work was appreciated.
2) I felt very happy, knowing that my work was appreciated.
The adjective bad used after feel can have several meanings: "unhappy," "regretful," or "unwell":
3) I felt very bad ("unhappy"), realizing that nobody appreciated my work.
4) I felt very bad ("regretful") about missing my son's birthday party.
5) With my cold and fever, I felt so bad ("unwell") that I called in sick.
Badly, in contrast, is an adverb, used to modify action verbs:
6) Leon usually plays golf superbly, but today he played very badly.
7) I had to return my computer to the shop because they repaired it badly the first time.
Badly is also used as an intensifying adverb meaning "very much" with verbs such as want and need:
He wants badly to win this time
You need a haircut badly
Although badly is used instead of bad after feel by a significant number of speakers, its use in writing is not recommended by grammarians or authorities on written style.