Long story short, the police can ask you your name if they have a reason in any state.
For example if they are chasing someone matching your description, they can ask you to identify yourself, etc, etc.
If they just stop you for no reason you can refuse unless you are in a state that legally requires you to answer.
New York has a "stop and identify" law which says that
a police officer may stop a person in a public place located within
the geographical area of such officer's employment when he reasonably
suspects that such person is committing, has committed or is about to
commit either (a) a felony or (b) a misdemeanor defined in the penal
law, and may ...
When you make a request based on the GDPR, Art. 12(6) GDPR applies.
Without prejudice to Article 11, where the controller has reasonable doubts concerning the identity of the natural person making the request referred to in Articles 15 to 21, the controller may request the provision of additional information necessary to confirm the identity of the ...