The basis of saying the adhān and the iqāmah in (respectively) the right and left ears of a new born baby is in deed the Sunnah of the Prophet (sws). You know that there are many authentic religious customs that are derived from the Sunnah rather than the Qur’ān.
A number of these customs have a symbolic nature. Among them is saying the adhān and the iqāmah in the ears of a new born baby. The aim of this is not to teach the baby anything (which as your question implies seems useless), rather it is to symbolise the responsibility and the good intention of parents to convey the teachings of Islam to their new born baby. These symbolic acts (even in non-religious contexts) usually have profound effect on one’s attitude and motivation towards what one is determined to achieve.
Referring to this Sunnah, Mr. Ghamidi writes:
This Sunnah was initiated by the Prophet Muhammad (sws). The words of the اذان (Ādhān) and the اقامة (Iqāmah) adopted by the Prophet (sws) in accordance with the guidance he received from the Almighty encompass very comprehensively the whole message of Islam in a very concise and moving manner. A true believer is forever an addressee of this message. All of us hear these words five times a day from our nearby mosques. Sounding these words in the ear of a newborn is a symbolic expression of the fact that just as his parents have transferred their physical being to him, they have initiated the transfer of their spiritual being to him with words that convey the basic message of Islam. (Ghamidi, Mīzān, 643 tr. Shehzad Saleem)