in ↔︎ im
The word »im« is a contraction of the preposition »in« and the article »dem«. So, the difference between »in« and »im« is the presence of an article, and this is also the reason why »im« works only in dative case, only in singular, only for masculine and neuter nouns, and only if you talk about a certain thing ("definite" i.e. not about just any thing), because »dem« is the definite dative singular article for masculine and neuter nouns.
- dative singular masculine definite
Die Leute sind im Wald. = Die Leute sind in dem Wald.
- dative singular neuter definite
Die Leute sind im Haus. = Die Leute sind in dem Haus.
- accusative singular masculine definite
Die Leute fahren in den Wald.
- dative plural definite
Die Leute sind in den Wäldern.
- dative singular feminine definite
Die Leute sind in der Hütte.
- dative singular masculine indefinite
Die Leute sind in einem Wald.
So your question boils down to: Do I have to use »New York« with or without an article?
Articles of geographic names
Names of places where no or just a few people live are used with an article. This can be seas, rivers, lakes, forests, mountains etc.:
Viele Flüchtlinge ertrinken jedes Jahr im Mittelmeer.
Lange gab es keine Lachse im Rhein.
Reichenau ist die größte Insel im Bodensee.
Machen Sie Urlaub im Wienerwald!
Im Dachstein liegt eine große Eishöhle.
But places where people live are used without an article. Such places can be anything from the smallest village up to continents.
In Trabersdorf leben nur 15 Menschen, es ist das kleinste Dorf in Österreich.
In Asien leben 4,46 Milliarden Menschen, das sind rund 60% der Weltbevölkerung.
And for this reason also all names of cities are used without an article:
Im Jahr 1910 lebten mehr Menschen in Wien als in Berlin.
Der Kreml steht in Moskau.
Manhattan liegt in New York.
So, the answer to your question is:
correct: Was ist am 11. September 2001 in New York passiert?
wrong: Was ist am 11. September 2001 im New York passiert?
Exceptions
Maybe you don't want to talk about just New York, but about a specific version of New York. The city is constantly changing, and you might want to talk about the New York of 1930. So, it's a very specific version of New York, and this requires a definite article. And because in German all cities are grammatically neuter, you have to use the article »dem« in dative case, which merges with »in« to »im«:
Im New York der frühen 1930er-Jahre war es verboten, Alkohol herzustellen.
Im Wien des Jahres 1910 lebten mehr als 2 Millionen Menschen.
You also turn a geographic place into a special version of it (at least in a grammatical manner) by adding any other attributes:
Im schönen Frankreich gibt es viel zu sehen.
Im weit entfernten Sidney zieht die Sonne im Norden über den Himmel.
Im Amerika, das man im Film sieht, gibt es fliegende Autos.
Another class of exceptions are some countries that are always used with an article:
Ich war noch niemals im Senegal.
Bagdad liegt im Irak.
There is a similar question in German language, and in the answers you will find lists of countries that are used with an article together with their grammatical genders.