As אילפא notes in the comments above, this notion is brought down in the Binyan Yehoshu'a:
נאמר בשם הרמב״ם אם לא נדבר בתינוק הנולד שבעה שנים שום דבור כאשר
יגדל ידבר מאליו לה״ק שהתולדה הוא מבטן
It is said in the name of the Rambam that if one does not speak
anything to a child after it has been born for seven years, when the
child develops he will speak the holy language [Hebrew] from himself
for the consequence is in utero
He does not however state where the Rambam has written this, nor does he state where he heard this from.
The Yad Efraim s. 30 addresses the same question of provenance:
סימן ל
בענין שאלתו ששמע אומרים בשם הרמב"ם שאם לא ילמדו לתינוק בר ישראל לדבר
שום לשון וגם לא ישמע מדברים איזה לשון אז מעצמו ידבר לשון הקודש ושאל
באיזה מקום כתוב כן הרמב"ם.
תשובה
גם אנכי שמעתי כן כד הוינא טלי' בשם מאור עינינו רבינו משה בר מימון
וחפשתי ולא מצאתיו בחיבוריו אשר הם אתנו ורק מצאתי במגדל עוז להיעב"ץ
בחלק עליות הלשון פ"ב כתוב בזה הלשון ואמרו שאם יגדל הילד ולא ישמע
לשונות אחרים אז יתחיל לדבר לשון הקודש מעצמו בלי לימוד שהוא לשונו
המוטבע בו עכ"ל.
Sec. 30
In the matter of the question that it has been heard in the name of
the Rambam that if one does not teach a Jewish child to speak any
language, and that child also has not heard any language, it will on
its own speak the sacred language [Hebrew], and so the question is:
where did the Rambam write such?
Responsum:
I also recall hearing such in my youth in the name of the great
illuminator of our eyes, our master Moses son of Maimon, and I
searched and did not find it in any of his compositions that we have.
I only was able to find it in the Migdal ‘Oz of the Yabhes [R. Yaaqobh
Emden] in the section ‘Aliyoth ha-Lashon ch. 2, wherein he writes
this language and states that it is said that if a child is raised and
does not hear other languages he will begin to speak the sacred
language [Hebrew] by himself without having been taught, for that is
the language that is embedded within him.
And we see that he also has heard of this idea in the name of the Rambam, but found no evidence of it in his known writings. Rather he found an allusion to it in the writings of R. Ya'aqobh 'Emden.
R. 'Emden (בירת מגדל עוז:בית מדות: עליית הלשון פ"ב) wrote pretty much verbatim as quoted in the Yad Efraim:
ואמרו שאם יגדל הילד ולא ישמע לשונות אחרים, אז יתחיל לדבר לשון הקודש מעצמו בלי למוד שהוא לשונו המוטבע בו.
With the only relevant contextual addition being the word being "ואמרו" - "and they say/said". Unfortunately this does not tell us who the anonymous "they" is. Which IMHO suggests that this was a bit of folk-wisdom in circulation, rather than something received by tradition.
R. 'Emden later retracted his opinion on this altogether in his commentary on the Mishnah (לחם שמים):
שאינו לא שומע ולא מדבר שנולד חרש וכיון שלא שמע מעולם אי אפשר שידבר זה
לא כמו שכתבתי שאם יושם הילד במקום שלא ישמע שם מדברים אז יפתח פיו לדבר
בלשון הקודש מעצמו אלא צריך לומר שהדיבור קשור בחוש השמע
That he is unable to hear and cannot speak: for he was born as a
heresh and since he never heard anything in his life it is not possible for him to speak. And it is not as I have previously written
that if a child is left alone in a place where he doesn’t hear
anything he will begin to speak the sacred language [Hebrew] by
himself, rather you must say that his speech will be bound [i.e.
incapacitated].
His comment here is based on the Mishnah Terumoth 1:2 about which the Bertenura also wrote:
וכיון שלא שמע מעולם מה שמדברים לו א"א לו שידבר
Since [the heresh] has never heard anything spoken to him, he is not
able to speak.
It seems likely that this notion, that a child left to their own devices will develop Hebrew, was a bit of popular-knowledge/folk-wisdom in circulation and not something from an authoritative source. Which would explain why R. 'Emden had no compunction about retracting and disagreeing with it. Indeed, he seems convinced that traditional rabbinic sentiment overtly contradicts such a notion.
So to summarize, it seems like bit of a mystery about how this notion originated and how it came to be attributed to the Rambam. However one of the earliest to articulate this idea, R. 'Emden, did not himself attribute it to the Rambam but rather generically quoted the notion as "they say". Indeed he later retracted his opinion on the credibility of this idea, as he found it to be in contradiction to the Mishnah.