"Ummi" in Qur'an 7:157 is generally taken to mean "unlettered". That is, the Prophet (S) did not read and write, and did not receive schooling. Therefore, the fact that he was able to provide a complex book with an eloquent style is further proof that the Qur'an was a divine miracle, since he did not have the education necessary to write a complex and eloquent book, or the ability to read previous scriptures and then write responses to them.
Sunnis tend to hold that the Prophet (S) was illiterate. Shi'is tend to hold that the Prophet (S) had the intrinsic knowledge of reading and writing, as part of his perfection and innate access to knowledge through Allah, but that he chose not to read or write. In any case, there is no evidence that the Prophet (S) ever read or wrote everything personally; instead, he had scribes take dictation for him (such as letters to others, or the Qur'an).
There are some mystical views which hold that the adjective "ummi" might reflect a sort of childlike simplicity or innocence. Especially since, in Islam, children are seen as being born pure and sinless. For instance, we refer to children as "innocent" because they don't have the sense of trickery, cunning, deceit, greed, or desire for power and carnal indulgence that some adults develop throughout life, and which can cloud their spiritual faculties. So, a person who is a mature adult but who nonetheless has a pure and "innocent" soul would still have a sort of childlike purity even if they are spiritually, intellectually, and socially mature. However this is not with respect to the Prophet's formal knowledge but rather - if it is a correct interpretation - would simply allude to an inner purity that would make him a suitable receptacle to receive the divine word in its purest form, just as if I want to write a text on a chalkboard, I will have the best results on a pure and clean chalkboard rather than one with a lot of marks.
In any case, it would be an additional interpretation to the above. Certainly the Prophet (S) demonstrated a lot of knowledge and wisdom in his life and management of the community so obviously his knowledge was well beyond that of a child.
It has also been suggested that "ummi" may refer to the designation of Mecca as the "mother of cities" (umm al-qurra) and therefore associate the Prophet with Mecca.
Maybe all of the interpretations have some truth but the first one is the most common ascribed to the text.
This is a belief which is held and originates from our brothers of the self proclaimed Sunni sect. Unfortunately this type of thought also found its way among some Shias. It has been answered already on different some Shia websites so I’ll transfer the narrations of our 9th Imam (as) for your benefit to this Q & A:
Al-Saffar (May Allah be pleased with him) reported: Narrated Ali bin Asba`t or [and] others who had said: "I said to Abu` Jafar (al-Jawad): 'People claim that the Prophet (peace be upon him and his pure family) could neither read nor write!' So, he, peace be upon him, denied that and said: 'They have lied, May the wrath of Allah be upon them! How would that be? When Allah, the Exalted, has said: '(It is) He who raised among the Ummīyīna (i.e. maternals) a Messenger from amongst them, reciting upon them His signs and purifying them and teaching them the Book and the wisdom; even though beforehand they were in a clear straying' How did he teach them the Book and the Wisdom while he could neither read nor write?’
Then Ali bin Asba`t asked the Imam: "Why was he called al-Nabi al-Ummi? To which the Imam (peace be upon him) replied: "Because he was ascribed to Mecca. That is according to the words of Allah, the Most Exalted: 'That you may warn Umm al-Qura` (i.e. the mother of villages) and those around it.' Umm al-Qura` means Mecca. So, he was called Ummi.” (Basair al-darajat, By al-Saffar, vol. 5, p. 246).
Furthermore, al-Saduq (May Allah be pleased with him) reported: Narrated Ja’far ibn Muhammad al-Sufi: “I asked Abu Ja’far Muhammad son of Ali al-Rida (peace be upon them both) saying: ‘O son of Allah’s Apostle, why was the Prophet called Ummi?’ He answered: ‘What do the people say?’ I said: ‘They claim that he was called Ummi because he was illiterate.
“He replied: ‘They lie! May the curse of Allah be upon them, Allah has clearly said in His Book: ‘(It is) He who raised among the Ummīyīna (i.e. maternals) a Messenger from amongst them, reciting upon them His signs and purifying them and teaching them the Book and the wisdom’ How would he teach what he himself could not do?
“By Allah, Allah’s Apostle (peace be upon him and his pure family) used to read and write in 72, or he said 73, languages. He was called Ummi because he was from Mecca. Mecca is one of the mother towns, and this is why Allah the Most Exalted has said: ‘So that you (Muhammad) may warn the mother of villages (i.e. Mecca) and whoever is around it’.” (Ma’ani al-Akhbar, By al-Saduq, p. 53).
May Allah grant you success
This is one of the misunderstandings among some Muslims caused by allegations on the Prophet (SAWA) created by his enemies. The Prophet Muhammad (SAWA) has achieved the maximum knowledge in the history of all human beings as he was taught by Allah, The Glorious who told him in Quran ( And Allah taught you everything which you did not know) (4 : 113).
The Prophet Muhammad (SAWA) was never illiterate but was from Umm Al-Qura which is one of the names of Makkah, that is why he was called as Ummi.
The Infallible Imams (AS) have clearly refuted this allegation in many occasions. Imam Muhammad Al-Baqir (AS) was asked: People claim that the Messenger of Allah ( SAWA) was not able to read or write. Imam (AS) said: They lied, curse of Allah be on them, how can it be possible when Allah The Glorious said: He who sent among the Ummeyeen ( People of Makkah) a Messenger from them, to recite on them His verses, He, and to purify them, and to teach them the Book and the Wisdom, while they were before that in obvious astray. How can he teach them the Book and Wisdom when he does not know reading or writing? He was asked: then why he was called as the Ummi prophet ? Imam (AS) said: because he was from Makkah, and Allah said in Quran : So that you warn Ummul Qura and what is surrounding it. Ummul Qura is Makkah, and that is why he was called Ummi. ( Elal al-Sharaaye').
There are Hadeeths that the Prophet Muhammad (SAWA) was taught by Allah reading and writing in 73 languages.