Michael Williams faces charges of attempted first-degree murder, aggravated battery, aggravated discharge of a firearm and unlawful use of a weapon as a felon in connection with the incident, CPD said early Thursday morning.
He was arrested just after 1:20 a.m. Wednesday in the 7200-block of North Sheridan Road, police said.
He had reportedly left the scene of the shooting and was spotted by police, who conducted a traffic stop.
The mother and child were both being treated at Stroger Hospital Wednesday.
The mother was in good condition, and her baby boy had been stabilized after being shot in both legs.
Chicago police said this started just before midnight Tuesday, when a man began shooting through the window of the garden apartment where they were.
RELATED: Cicero shooting: Uber driver shot in attempted robbery ID'd as NW Indiana father of 3
It took place in the 5200-block of West Congress Parkway, CPD said. Both were rushed to Stroger Hospital, as police continue to investigate whether they were the intended targets of the shooting or if it possibly could have been someone else inside the apartment at the time.
Area Four detectives are investigating.
Williams is next due in court Thursday.