In Gita 2.14, Krishna says (Swami Gambhirananda translator):
- But the contacts of the organs with the objects are the producers of cold and heat, happiness and sorrow. They have a beginning and an end, (and) are transient. Bear them, O descendant of Bharata.
and in Gita 9.8-9, Krishna says:
- Keeping my own Prakrti under control, I project forth again and again the whole of this multitude of beings which are powerless owing to the onfluence of their own nature.
'In that case, You, who are the Supreme God and who ordain this multitude of beings unequally, will become associated with virtue and vice as a result of that act?'
In answer the Lord says this:
- O Dhanajaya (Arjuna), nor do these actions bind Me, remaining (as I do) like one unconcerned with, and unattached to, those actions.
[and part of the commentary]...As to that, the Lord states the reason for Him not becoming associated with the actions: Asinam, remaining (as I do); udasinavat, like one unconcerned, like some indifferent spectator-- for the Self is not subject to change; and asaktam, unattached; tesu karmasu, to those actions--free from attachment to results, free from the egoism that 'I do'.
Hence, even in the case of any other person also, the absence of the idea of agentship and the absence of attachment to results are the causes of not getting bound. Otherwise, like a silkworm, a foolish man becomes bound by actions. This is the idea.
Brahman is Self-existent, eternal, and unchanging. To have joy or sorrow is to have attachment or a hankering for a transient object - it arises from desire; and as Gita 3.34 says "Attraction and repulsion are ordained with regard to the objects of all the organs..."