Large parts of NYC (much of the outer boroughs) are not near the subway, and not within walking distance of a supermarket (especially if you're carrying groceries for an entire family). Millions of people live there because they can't afford Manhattan rents, especially for a family-sized apartment.
Also, transit lines tend to connect well to mid-Manhattan but poorly between other locations. So if you live in Queens and work in Brooklyn, good luck getting to work reliably by public transportation. (Before you object to that arrangement, consider: If you own a house and have kids in school, you're not necessarily going to uproot your family and move just because your new job is further from home.)
Thus, many ordinary New Yorkers rely on cars to commute to work.