The criterion for whether a city celebrates Purim on 14 Adar or Shushan Purim on 15 Adar is whether it was walled in the times of Joshua (about 3300 years ago). (Well, Shushan itself is an exception, but that's a different story….)

If Jerusalem was not in Jewish hands until the times of King David (~3000 years ago), how do we know that at the time Joshua entered Israel, 300 years prior, it had a wall? Did King David find any Jebusite documents inside the city proving it was over 300 years old? Was there sufficient knowledge of geography in the times of Joshua that the Jews knew Jerusalem existed as a walled city, even though they didn't conquer it?

"The children of Judah were unable
to dislodge the Jebusites, inhabitants
of Jerusalem. The Jebusites dwelled
among the children of Judah in
Jerusalem to this day."

Rashi and Radak there explain that the Jebusites lived in the Fortress of Zion, and that this is the specific part of the city that remained in non-Jewish hands until King David conquered it.

Malbim (to Jud. 1:8) reconstructs the events as follows: the Judahites made a first attempt to conquer the entire city in Yehoshua's times (after its king joined a confederation to fight against the Jews and was killed in the attempt, Josh. ch. 10), but failed to do so, so it became a mixed Jewish-gentile city. (Not much has changed in 3000 years!) Later on, in the period of the Judges, the non-Jewish inhabitants revolted against the Jews, so the Judahites burned the city in reprisal, but were still unable to conquer the fortress, and so that became the city's non-Jewish quarter. (Part of the city was also in the territory of the Tribe of Benjamin, and by rights they should have done their part to drive out the non-Jews too, but didn't; Jud. 1:21 criticizes them for this.)

At any rate, the main point for our purposes is that Jews were present in Jerusalem not long after their entry into Eretz Yisrael.