The difference is in what types of words they are:
"it" is a personal pronoun, while "this" and "that" are demonstrative pronouns.
"it" can refer to an object, an idea, a problem, etc. and is used as a replacement instead of mentioning the thing it refers to again and again.
"this" and "that" can indicate/point out something that has already been mentioned or that you can literally see and point at.
"this" refers to something that is closer to you, while "that" refers to something that is further away.