If you lived in NJ but worked in NY, you have to file a non-resident NY return.
New York collects taxes on income you earned while working there and, as NJ resident you will be taxed on all your income. To avoid double taxation, you will claim credit for taxes paid to NY on your NJ resident