Why does Jupiter have so many moons? Jupiter has a great many moons - in the hundreds, and they're still being discovered.

What is the current theory for where all these moons came from? Are they rocks flying through space captured by Jupiter's gravity?
Mass.

The more massive a body, the larger the gap between its lowest and highest orbit; the range of speeds at which a random body entering its gravity is likely to remain as its satellite. Sun has millions of satellites if you count all the asteroids; smaller planets tend to have one or two moons at most (Pluto with five being a notable and not fully explained exception)

To a lesser degree there's a matter of shape too. A regularly round body will have more regular and stable orbit than a potato-shaped one. Jupiter, being a gas giant is perfectly round. This doesn't play that much of a role though, especially with higher orbits.

And last but not least, no destabilizing influence of other bodies. It's very hard to maintain a lunar orbit - artificial satellites around our Moon last only a couple years each, because relatively close neighborhood of Earth tends to destabilize orbit of anything orbiting the Moon. Jupiter being a single massive planet with relatively tiny (relatively to its mass) moons doesn't have them influence each other all that much.