Did Dante expect for this text to be made famous, or was he only intending for people in Florence to know about it? My teacher told me he hid it in the walls as well, and that it was his sons who published it.
Well first of all I'll start by saying that the "Comedy" as it was known at the time of his life (Dante called it comedìa himself in Inferno), as with many other large works at the time, was made public gradually, meaning that it was not published as a whole but in parts as they were completed and edited. He used to entertain epistular exchanges explaining things about his work; something completely normal at the time in the intellectual circles of Italy.
What your teacher is probably referring to is Paradiso, the last Cantico, which had to be published posthumously since he never stopped working on it until his death in Ravenna in 1321. The rest of his masterpiece was already known before his death and those intellectuals who had read the Comedy at the time knew Paradiso was supposed to come out aswell.
We also have to remember that Dante was a medieval scholar and these kinds of people (poets, scholars, intellectuals in general) were not exactly too common at the time. They were a small enough circle that the most famous ones would be probably known already, at least in their geographical areas, and Dante wrote plenty before the Comedy.
He wrote Vita Nova which is a collection of poems in vulgar italian in the style that was popular at the time of his late twenties.
He also wrote the Convivium, a philosophical essay; then he wrote De Vulgari Eloquentia which is a treatise on the virtues of using vulgar as a literary language and a political treatise called De Monarchia in which he explains his political beliefs regarding the Papacy and the Holy Roman Empire.
He was very involved in politics outside of Florence, even before the exile; he had been an envoy to pope Boniface VIII (whom he despised) for example.
We also have a collection of some of his letters, the Epistole, in which we see that he sent correspondance to many powerful and influential people at the time: cardinals, lords, and even one sent to emperor Henry VII.
He also did not hide the fact that he was well known; in the Comedy itself there's many passages where he claims to have known important people who were dead at the time.
He also put references to his own previous work (especially Vita Nova) in the poem itself which means he probably expected the audience to at least be aware of them.
Now we can certainly say that the work was not at all intended for Florence only since he started writing the Comedy after the exile from his hometown, whether this means that he expected fame and success from writing it I cannot say for sure; he certainly aknowledged the very ambitious nature of the poem.
Sources:
Dante Alighieri: "The Divine Comedy", Inferno Canto XVI, XXI, XXXII. Purgatorio, Canto XXIV.
Dante Alighieri; "Epistole", letter XIII.
"Dizionario Biografico degli Italiani" (English: Biographical Dictionary of the Italians); vol. 2, Roma, Istituto dell'Enciclopedia Italiana, 1960.