Improper relationships and the abuse of power can sometimes allow enemies to gain a physical foothold within the most sacred spaces. The background of these events centers around Eliashib the priest, who exploited his position in the Temple to grant favors to his close associates.
The timeline of these events takes place before the situations mentioned earlier in the narrative. Some explain that this history happened before the formal separation from the foreigners [אבן עזרא, מצודת דוד]. Others view this background as an introduction, explaining the actual reason why the Torah was read to the people on that specific day [מלבי״ם].
Eliashib either held an official role overseeing the Temple chambers [ביאור שטיינזלץ] or sat within them on a permanent basis [מצודת דוד]. Using the authority of his position, he acted out of a deep personal connection to Tobiah. The primary approach among commentators is that Tobiah was an Ammonite, an enemy of Judah, and a friend of Sanballat.
The connection between the priest and the enemy showed not only in personal friendship but in physical closeness inside the Temple. During this period, the people had stopped bringing their required contributions and tithes. As a result, the large chamber normally used to store these offerings sat completely empty. Taking advantage of this situation, Eliashib prepared this large room for Tobiah, locating it right next to his own space. He allowed him to move in, live there, and store his personal belongings inside the sacred grounds [רש״י, מלבי״ם].