Police say the witness saw the child's reflection with Gray in a bathroom stall. Investigators say Gray, who was in a motorized wheelchair, pulled out a stun gun and tried to keep the witness from leaving the bathroom.
It's not clear how Gray knew the 2-year-old.
Gray faces charges of sexual battery of a child younger than 12, lewd or lascivious battery and molestation, child abuse and contributing to the delinquency of a minor.
He is jailed without bond and it's unclear if he has a lawyer.