This question isn't answered explicitly in the film, but certainly several plausible inferences can be drawn based on circumstances. First, both of the boys are slight social outcasts among their peers. Simon Birch, obviously, because of his size, voice, and sheer intelligence over other kids his age, will never fit in. Add to this the fact that even as an only child, he's basically ignored at home.
Joe, on the other hand, also an only child, is also a bastard child. He lives with his mother and grandmother, in a large house which reaks of old money. He doesn't know who his father is, and no one in the small gossipy town does either. Being the son of a young and beautiful single mom from a prominent name in a small town puts a target on his back, even if it isn't exactly visible by other 12 year olds. Joe knows this. He also knows this is something that will eventually catch up with him.
Simon Birch is a natural ally. First of all, he won't judge. Second, he's in love with Joe's mom.
Joe's mom, of course, is the second thing that ties the two together. They spend enough time together (and Rebecca treats Simon like a son) that they act like brothers. When Rebecca dies, it is like a permanent bond between them is fully sealed. It isn't simply the fact that Simon Birch killed her. It is the fact that they both lost perhaps the one thing they loved most in the world. In her absence, all the two have left is each other.