He learns from the street urchins, who are surprisingly literate despite their poverty. They teach each other to read by deciphering signs and advertisements, and Tom becomes quite skilled in reading and writing.
This is a key element of the story, as it demonstrates the power of education and self-reliance, even in the most challenging circumstances.