The New York City income tax is on residents of New York city regardless of where they work.
Non residents of New York city do not pay New York city personal income tax unless they are employees of the City of New York.
Part year residents of New York City pay New York city income tax for their resident period only.
For more details see Who is Subject to this Tax? from NYC Finance.
I hope this helps to know who is subject to NYC personal income tax.