I'd say art comes from creativity and autonomy, and ultimately from our alienation from the nonhuman world. We have an existential encounter with an impersonal or foreign environment, with something outside the self, and we strive to reconcile ourselves to that fact, to our mortality and to the rest of our existential condition, by sublimating our suffering with artistic creations.
I'm not sure what you're saying about religion. But religious explanations will always pale next to naturalistic ones because we don't increase our understanding by explaining a mystery only by positing a bigger mystery.