This is American policing, I've been pulled over or even detained for just walking several times. I think it's a combination of power tripping, nothing better to do with large police forces and many vehicles, and a fundamental distrust of any transport that isn't a car. And of course the legal and moral framework that allows for random abuses of rights and an overall acceptance of a papers-please force.
Hate to ask but are you a person of color? My brown friends have been pulled over and stopped while just walking around many more times than me (plain white dude). I have been pulled over one time in my life and never so much as had more more than a “hi how are you doing?”from a cop on the street.
FWIW I had my car get totaled while I was a freshman in college and walked to it the day after. Cops stopped me 3 times on approx a 6mi walk, wouldn't leave me the fuck alone until I pulled out ID. I'm white and this was in NJ, we are not a stop and identify state. Apparently teen walking down the road with a backpack in middle of day is suspicious.
This was around 17 years ago, cant imagine how ridiculous it is now.