The adverb “literally” means “in the literal or strict sense”. For instance, it is commonly used when translating between two languages word for word, ignoring the real meaning, as in
“Figuratively”, on the other hand, means “metaphorically; involving a figure of speech”. For example:
By using the word “figuratively”, we make it clear that the man was not in fact dead; he was just extremely exhausted.
The ‘literally vs. figuratively’ debate
There has been a debate going on for decades whether it is possible to use “literally” in the sense of “figuratively”. It is extremely widespread to use “literally” as an intensifier, as in:
Language purists claim that such usage is “simply wrong” because the speaker died only figuratively, not literally. To be honest, I find the whole debate rather silly.
Exaggeration is a normal part of every language, and saying that you “literally died” when you just “felt close to being dead” is just an example of hyperbole (i.e. exaggeration used as a figure of speech). Why does nobody argue that
I am so hungry I could eat a horse.
are “simply wrong”? No one tells something a million times, and not a single human being can eat a whole horse (in one sitting, anyway).
I personally believe that the main reason why the issue has been debated so passionately is that the word “literally” has become extremely overused, not because using it in a metaphorical sense is wrong.
Some people say “literally” in almost every sentence. When you listen to someone saying, “I just literally bought the worst pair of shoes in literally the weirdest shop ever, and the cashier like literally didn’t care”, it gets on your nerves quite quickly. On the other hand, when used appropriately, it can help you get the message across.
All in all, I think it is absolutely fine to use “literally” occasionally when you exaggerate in informal communication. Just don’t overdo it.