If someone suddenly changes his behaviour from being friendly to being aloof, you could say he is "giving you the cold shoulder". You could also say he "snubbed you" or gave you the "brush off".
To describe such a person, I might say they are "ungracious", "condescending" or "dismissive".
Hope this helps