"are emotions the byproduct of our intelligence and brain development which prompted our social development
To this, it's mostly a yes. It's not so much intelligence--while we may have what is perhaps the greatest range of emotions and most complex social behavior, intelligence isn't a requirement.
or did the chemical changes develop first and spur on the development of our brains and thus our social evolution
I would say yes to this question. If I understand you correctly, the "chemical changes" are the mutations, right? If so, it would be mutations that improved our brain, allowing for an ever more complex social interactions (in our case. Unfortunately, we don't know of any other entities that have our level of intelligence, so we've no clue if this social behavior is the norm for all highly intellignet organisms).
As to your last question, we know how mutations happen. We also know why they happen, but this "why" has no intent. Hope that helps.
All a man's knowledge comes from his experiences