If you lived in NY from Jan to Aug, you are considered a part-year NY resident. Since you did not live in NJ for the full year in 2021, you are also considered as a part-year resident in NJ.
You need to file at least two part-year resident state returns.
Your resident state is NJ since it is the state you resided in on 12/31/2021.
If you have a place in NY that you call your home, then you are maintaining a permanent place of abode in NY. If you have no place to call home in NY after you moved, you are a nonresident in NY.
**Say "Thanks" by clicking the thumb icon in a post
**Mark the post that answers your question by clicking on "Mark as Best Answer"