All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ʻalayhi wa sallam, is His slave and Messenger.
There is no harm in attributing the child to any of his male ascendants and not necessarily give him the direct name of the father. Imaam Al-Bukhari allocated a chapter in his book "Saheeh Al-Bukhari" entitled "Whoever attributed himself to his male ascendants in Islam and the pre-Islamic era", and he cited the hadeeth on the authority of Al-Baraa' ibn ʻAazib in which the Prophet, sallallaahu ʻalayhi wa sallam, said, “I am the Prophet of Allaah, undoubtedly; I am the son of ʻAbdul Muttalib.” therein.
If the child is named “Waajid Muhammad,” or “Maryam Faatimah,” or the like, as a compound name, then there is no religious impediment to naming a child with such compound names.
It is also allowable to attribute the child to his mother or her family. Shaykh Ibn Baaz wrote, “The daughter’s sons are called the sons of their maternal grandfather. It has been authentically reported that the Prophet, sallallaahu ʻalayhi wa sallam, said about Al-Hasan ibn ʻAli 'This son of mine is a master.' Al-Hasan was the son of his daughter Faatimah and with her sons Al-Hasan and Al-Hussein...”
The fact that people shall be called with their father's names on the Day of Judgment does not mean that it is impermissible to attribute the child to his mother in the worldly life because it is a true attribution. It is allowable to attribute a child to his mother unless the purpose behind doing so is Islamically invalid.
Allaah knows best.