Before going any further, It must be emphasized that Destiny is one of the articles of faith in Islam and cannot be discarded.
There are four (Ranks) parts to believing in Destiny in Islam.
1 - Allah’s Knowledge: Basically, this is accepting that Allah knows EVERYTHING. He knows what has happened and what has not happened. He knows what would have happened if something did not happen. Nothing, absolutely NOTHING, escapes His knowledge.
(وَعِندَهُ مَفَاتِحُ الْغَيْبِ لَا يَعْلَمُهَا إِلَّا هُوَ ۚ وَيَعْلَمُ مَا فِي الْبَرِّ وَالْبَحْرِ ۚ وَمَا تَسْقُطُ مِن وَرَقَةٍ إِلَّا يَعْلَمُهَا وَلَا حَبَّةٍ فِي ظُلُمَاتِ الْأَرْضِ وَلَا رَطْبٍ وَلَا يَابِسٍ إِلَّا فِي كِتَابٍ مُّبِينٍ) الأنعام, آية 59
“With Him are the keys of the invisible. None but He knows them. And He knows what is in the land and the sea. Not a leaf falls, but he knows it, not a grain amid the darkness of the earth, nor anything green or withered but is recorded in a clear Book”. (Surah al-An’am, 59)
2 - The Writing: This means that everything in existence, all actions, speech, events, EVERYTHING, was recorded in the Preserved Tablet (Lawhul Mahfuz). This is confirmed in the Qur'an where Allah states:
(ألم تعلم أن الله يعلم ما في السماء والأرض إن ذلك في كتاب إن ذلك على الله يسير) الحج, آية 70
“Do you not know that Allah knows what is in the heaven and earth? Indeed, that is in a Record. Indeed that, for Allah, is easy.” Surah Al-Hajj, 70.
3 - Allah’s Creation: Accepting that Allah has created all things. This includes physical things like humans and animals, as well as non-tangible things like our actions and world events. We believe that
(الله خالق كل شيء وهو على كل شيء وكيل. له مقاليد السماوات والأرض) الزمر, آية 62-63
"Allah is the Creator of all things; He is the Guardian over all things, and to Him belong the keys of the heavens and the Earth" (Surah Al-Zumar, 62-63)
4 - Allah’s Will: Accepting that nothing happens outside of Allah’s will. If Allah does not will for something to happen, then it will never take place. And if Allah wills for something to happen, then with absolute certainty, it will happen.
In the Sunnah, there are many traditions (Hadith) about the Destiny.
Here is a narration from Hudhaifa b. Usaid, he reported directly from Allah's Messenger (may peace be upon him) that he said: When the drop of (semen) remains in the womb for forty or fifty (days) or forty nights, the angel comes and says: My Lord, will he be good or evil? And both these things would be written. Then the angel says: My Lord, would he be male or female? And both these things are written. And his deeds and actions, his death, his livelihood; these are also recorded. Then his document of destiny is rolled and there is no, addition to and subtraction from it. (Sahih Muslim)