I am trying to understand the difference between these two terms. In some contexts that these two terms have been used interchangeably. What is the exact difference between these two terms ?
A Code Smell is something which should be investigated. Is it a piece of delicious cheese or is it rotten beef? An Anti-Pattern is just bad, a Code Smell is something which may or may not be bad.
This quote from the Wiki page is extremely relevant (the emphasis is from the original source):
Note that a CodeSmell is a hint that something might be wrong, not a certainty. A perfectly good idiom may be considered a CodeSmell because it's often misused, or because there's a simpler alternative that works in most cases. Calling something a CodeSmell is not an attack; it's simply a sign that a closer look is warranted.
An Anti-Pattern is a Pattern which, when you follow it, will lead you towards a worse design in the same way that a Pattern will lead you towards a better design:
An AntiPattern is a pattern that tells how to go from a problem to a bad solution. […] In the old days, we used to just call these 'bad ideas'. The new name is much more diplomatic.
"Code smells" are an insulting judgement of someone's code, based on blindly applying some rule without understanding it. It's a word that is used by some anti-social programmers. NEVER use this word in my presence. You will not be happy.
A "pattern" is something that many people use to solve some kind of problem. An "anti-pattern" is a pattern that doesn't work and gets you into trouble. "Pattern" is often also used to mean "a pattern that works" since things that don't work usually don't become patterns.