He had been chosen by lot (which was how the priests were assigned duties) to go into the temple of the Lord, where he was supposed to burn incense.
That’s how everything was arranged in the holy tent. The priests came regularly into the outer room to do their work.
So Judas threw the money into the temple and left. Then he went away and hanged himself.