When other Arab children were born...
When other Arab children were born, some idolater came to greet them and to take them in his arms. But when Ali was born, Muhammad, the future Messenger of God, came into the precincts of the Kaaba to greet him. He took the infant into his arms,, and dedicated him to the service of Allah. The future prophet must have known that the infant in his arms was some day going to be the nemesis of all idolaters and polytheists and of their gods and goddesses.
When Ali grew up, he extirpated idolatry and polytheism from Arabia with his sword. Birth in Kaaba was one out of many distinctions that God bestowed upon Ali. Another distinction that he enjoyed was that he never adored the idols. This again makes him unique since all Arabs worshipped idols for years and years before they abjured idolatry and accepted Islam.
It is for this reason that he is called “he whose face was honored by Allah.” His face was indeed honored by Allah as it was the only face that never bowed before any idol. Ali was the youngest child in the family. Of the three of his brothers, Talib and Aqeel, were many years older than him; Jaafer was ten years older. The birth of Ali filled the heart of the future Apostle with boundless happiness. The child was someone “special” for him.
After all, Muhammad had many other cousins and they had their own children, and Ali himself had three elder brothers; but he didn't show any interest in any of them. Ali and Ali alone was the focus of his interest and love. When Ali was five years old, Muhammad adopted him, and from that moment they were never to part with each other.
There is a story that once there was a famine in Makkah, and the surrounding areas, and Abu Talib, being in dire straits at the time, was finding it difficult to support a large establishment. It occurred to Muhammad that he ought to try to mitigate some of his uncle's burden of responsibilities, and was thus prompted to adopt Ali. It is true that Muhammad adopted Ali but not for the reason stated above.
In the first place, Abu Talib was not in such dire straits that he could not feed a child of five; he was a man of rank and substance, and his caravans plied between Hijaz and Syria or between Hijaz and Yemen. In the second place, feeding a child of five years would have hardly made any difference to a man who fed even strangers if they were hungry. Muhammad and Khadija adopted Ali after the death of their own sons. Ali thus filled a void in their lives.