According to court documents, 18-year-old Kemari Johnson asked a probation officer if he could surrender something while he was waiting to be released. He then pulled out a semi-automatic handgun and a magazine.
Johnson now faces a felony charge for having a firearm inside a jail.
It's not clear how long he had the weapon or how he got it in the first place.
The Cook County Sheriff's Office says it's launched a criminal investigation as well as a separate administrative investigation.
No further information was immediately available.