Well, that was a plain weird story. I probably would not have reacted at all. Public area, public buildings, public doors. Until he went into one, including the outer door to the residences, he hasn't done anything illegal, and this is only vaguely suspicious or threatening. We have no idea of his motivation or intent.
I agree. Sit tight. Wait it out. If he goes on and keeps trying doors, well, call 911 and report that a possible burglar is going through the neighborhood trying doors. maybe if you could have done it discreetly, you could have watched him as he went on, as you did, to provide further information to police, if you called.
I'm not sure that entering that outer door to the apartments would be illegal entry. It was open, and even though he has no business there, is it illegal? dunno.
One thing, I congratulate and thank you for not just blowing it off.
That could have been zodiac, and my grandmother may have lived in the apartment across the hall from you. We gotta watch out for each other, and you did.