In addition to KeyBrdBasher's excellent out-of-universe answer I'd like to concentrate a bit more on Django's motivation, even if it's really just plain speculation on my part.
You have to consider that Django has been a slave for all his life, wearing nothing else than mere rags, if so much at all. It certainly makes sense for him to dress as extraordinarily as possible once he finally has the chance to. Seeing that his blue suit looks extremely fancy and is probably only worn to parties or by little rich boys, he has simply overdone it with his dress choice, maybe partly due to overcompensation and maybe partly due to a lack of knowledge what you would usually wear as an ordinary citizen (you could even connect both answers and assume Django has once seen that Gainsborough painting, dreaming to dress as fancily one time in the future).
Another factor might also be exactly this surprise that you mention in your question. Django maybe also wanted to show everybody that he was a free man, and this as expressively as possible. Thus it might also have been in order to shock all those slave owners with the unusual view of a black man in so fancy a suit.