The doctrine of the names begins in the Quran, which four times declares that to God belong al-asma al-husna, the most beautiful names, and commands, call upon him by them. Scattered through the scripture are the names themselves, the Merciful, the Compassionate, the King, the Holy, the Source of Peace, the Mighty, the Wise, sometimes gathered in clusters, as at the end of Surat al-Hashr, which strings a dozen names into a single doxology. The number comes from the hadith.
Sahih al-Bukhari and Sahih Muslim transmit the Prophet's saying that God has ninety nine names, one hundred less one, and whoever enumerates them, ahsaha, enters paradise, a word the scholars weighed carefully, reading it variously as memorizing the names, counting them, or living by what they mean. The familiar written list of ninety nine appears in the narration transmitted by al-Tirmidhi, and the learned tradition itself notes that this enumeration was compiled within the transmission rather than dictated as a fixed list, which is why alternative lists exist and why theologians insist the names of God are not limited to ninety nine. The names became the backbone of Islamic theology's account of the divine attributes, grouped by the scholars into names of majesty and names of beauty, jalal and jamal, severity and mercy held together in one God.