Many cities have ordinances that prevent sleeping in a car in a public place, including parking lots and streets. This is usually done as a response to a perceived need to regulate activities of homeless people.
For example, Austin, Texas has a “camping ban” that prohibits camping in a public area. The definition of camping in the ordinance includes “using … a vehicle for a living accommodation.” Austin City Code §9-4-11.
This has been interpreted to include sleeping in a car on a public street. As a practical matter, there are not a lot of prosecutions for violations of these types of ordinances, and most people are given a warning and asked to move. In addition, the ordinances generally do not prevent sleeping in a car on your own private property.