Why are planes flying in a zigzag path over Long Island when approaching JFK?
There are 3 STARs (Standard Terminal Arrival Routes) into JFK that cross over Long Island:


PARCH 3 RNAV ARR:


PAWLING 2 ARR:


ROBER 2 ARR:


(Jeppesen charts)


None of these have particularly pronounced zigzag patterns, so what you describe is probably not coming from the waypoints of the arrival procedure.

Looking at flightradar24.com, we can currently see BAW1 approaching JFK:



This already looks a bit more like a zigzag. It would seem they are arriving on the PARCH3 or ROBER2 until ROBER and then received radar vectors onto final approach for runway 31L/R. These vectors are typically given by ATC (Air Traffic Control) for spacing reasons.

When going back to yesterday evening using flightradar24's Playback feature, one finds much more pronounced turns over Long Island (thanks to ymb1 for suggesting this):



Here, aircraft are approaching runways 22L/R. You can see that there are also aircraft from the South and West joining the queue to land and ATC needs to make sure there is enough separation between the aircraft. The easiest way to achieve this is by instructing them to fly in a certain direction ("radar vectors") until there is enough space to fit them into the queue, which results in such a zigzag pattern.

Such turns can also be more localized than shown here. See e.g. Why did my LGA-ORD flight make an S-shaped turn round the time it was passing a storm?, where a flight into Chicago made an S-shaped turn during the descent, which would also feel like a zigzag. Such instructions can also be given to aircraft while they are still flying on the STAR over Long Island, especially when there is a lot of traffic during peak hours.