The shooting happened at about 9:15 a.m. in the 3300 block of West 13th Street in the Lawndale neighborhood, Chicago police said.
The child was sitting with his uncle in a vehicle outside the Douglass branch of the Chicago Public Library, police said. The boy's aunt had gone inside to make some copies.
While the toddler and his uncle were waiting in the vehicle, police said two men spotted a 35-year-old man and fired shots, hitting the man in the foot. The boy was struck by a stray bullet in the arm.
The toddler was rushed to Stroger Hospital in serious condition.
"This is another one of those situations that is totally unacceptable," a police spokesman said Thursday.
The 3-year-old has since been treated and released, according to his family.
The 35-year-old man remains in a hospital in good condition. Police said they don't know if he had a weapon on him at the time.
Gunfire also hit a squad car that was in the area on a separate call, the spokesman said. No officers were injured.
Chicago police were interviewing witnesses, seeking out surveillance footage and utilizing K9 units as part of the investigation but asked for the public's help, as well.
Police believe the shooting was targeted.
Interim police Supt. Charlie Beck also responded to the scene Thursday.
Those who live nearby said they're disgusted by the violence.
Resident Nadrea Satchell said she worries about her children growing up in this environment.
"Of course, by me being in the community, it is the norm, but it doesn't mean that I am still not scared and I am not scared for my children's safety," Satchell said.
Sun-Times Media contributed to this report.