It's actually two words, the proposition "in" and the word
"spite". Spite is a motivation for doing mean or cruel or hurtful
things, and often boils down to a kind of mean-spirited revenge.
"To cut off your nose to spite your face" is an expression meaning
that sometimes doing harm to another does greater harm to yourself.
The "spite your face" part, means that you think you are doing
something mean to your face by cutting off your nose.
Spite is often the feeling we have when we say, "I'll show
him!". It sometimes takes the form of wilful and peevish
disobedience as a kind of revenge. It is this meaning that comes
across in the phrase "in spite of". E.g. "My dad told me not to go
to the party, but in spite of what he said, I went anyway."
By extension, it can mean wilful and peevish disobedience to the
common-sense dictates of reality. E.g. "In spite of the pouring
rain, I determined to go tenting." The word "despite", which
obviously comes from the same root, means exactly the same
thing.