Usually when there's a choice between using the gerund ("-ing") or infinitive ("to" + base form), the infinitive form includes a future meaning. That's the case here.
"Don't be afraid of being different" is advice that holds at any time. It means something like, "Don't be afraid of the fact that you're different."
"Don't be afraid to be different" means something like, "Don't be afraid that other people will see you as different." It is advice you'd give to someone before they're about to do something where they have the option of being different, like going into a theatre audition, and they're not sure whether to play it straight or try to be unique.
That said, since fear of being different is mostly fear of being judged in the future, there's not a lot of practical difference between the two, so they're mostly interchangeable.