The child suffered serious injuries but survived.
District Attorney Kevin Steele announced the arrest of 34-year-old Luis Marin on Thursday.
The shooting happened at a home in Pottstown on the evening of May 15.
Investigators say Marin took two guns out of a bag and placed them on the bed.
He then allegedly told police he sat on the bed and was playing on his phone when he heard the shot.
The injuries to the child included broken ribs and a damaged lung.
"This shooting is a frightening reminder to parents that children, even very young children, can and do find unsecured firearms in a home, and their inclination is to play with them. Thankfully, this 2-year-old boy survived the shooting," said DA Steele.
Bail was set at $50,000 unsecured with the provision that no firearms be kept in the home.