Emotions, the example of other composers, religion, literary works (i.e. Faust) money, audiences, a desire to challenge themselves...Sure, let's assume all the great composers have talent. What then drove them?
Religion didn't motivate Janacek, and money did not motivate Schubert, but JS Bach and Donizetti were motivated in large part by God and money respectively.
However, I think the key ingredient is ego and recognition of one's own abilities. Without that, the great composers would have quailed.