One of the reasons for the immigration is while Tokyo is an expensive city, its costs can be compensated with a tiny apartment. However, it's not necessary to live in Tokyo. Many of the surrounding cities commute to Tokyo on a daily basis.
https://en.wikipedia.org/wiki/Tokyo#Demographics "During the daytime, the population swells by over 2.5 million as workers and students commute from adjacent areas. This effect is even more pronounced in the three central wards of Chiyoda, Chūō, and Minato, whose collective population as of the 2005 National Census was 326,000 at night, but 2.4 million during the day.[91]"