What you are asking is commonly referred to as a "stop and identify" statute.  Here is the Illinois statute: “A peace officer, after having identified himself as a peace officer, may stop any person in a public place for a reasonable period of time when the officer reasonably infers from the circumstances that the person is committing, is about to commit or has committed an offense.”  You only have to give your name in these statutes when you are in a public place. There is a gray area here if showing the ID to prove you are over 21 is proof that you are not committing a crime. And one does not really know what the police may be thinking.  God luck.