After pointing out (again) that I am not an attorney, let's start right here:
The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no Warrants shall issue, but upon probable cause, supported by Oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.
That's the Fourth Amendment to the US Constitution.
So can they just stop you to to ask you for your papers?
Generally, no.
Brown v. Texas, 443 U.S. 47 (1979)
The application of the Texas statute to detain appellant and require him to identify himself violated the Fourth Amendment because the officers lacked any reasonable suspicion to believe that appellant was engaged or had engaged in criminal conduct. Detaining appellant to require him to identify himself constituted a seizure of his person subject to the requirement of the Fourth Amendment that the seizure be "reasonable."
So you unless there's any "reasonable suspicion" that you're doing something criminal, they simply can't just ask you for your papers.