Prior to its spectacular plunge into Jupiter, comet P/Shoemaker-Levy 9 revolved about Jupiter as a temporarily captured satellite, the most recent of many comets known to encounter and even orbit the planet. Here we dynamically investigate Shoemaker-Levy 9's capture, orbital evolution, and origin. We find that Shoemaker-Levy 9 orbited Jupiter for most of this century, and possibly longer, nominally the longest known temporary capture. Secular solar perturbations caused Shoemaker-Levy 9's inclined and distant jovicentric orbit to alternate, with a period of ∼2 jovian years, between intervals of nearly polar inclination (i ∼ 90°) and low eccentricity and intervals of lower inclination (either prograde or retrograde) and nearly parabolic eccentricity (e ≈ 1.0). This latter phase brought the comet close enough for disruption within Jupiter's Roche limit in July, 1992, and collision in July, 1994. Immediately prior to the 1992 perijove, the comet passed through Jupiter's tenuous inner ring halo at 1.62 ± 0.01 jovian radii, but the population of macroscopic bodies in this portion of the ring is probably insufficient for collisions to have weakened or disrupted the nucleus. The comet's trajectory was among the most chaotic of any known solar system body, with an effective Lyapunov time in jovian orbit of ∼10 years. Because of the shortness of the Lyapunov time compared with the probable length of temporary capture about Jupiter, Shoemaker-Levy 9's heliocentric orbit prior to capture can be discussed only in a statistical sense. The ensemble of possible pre-capture solutions describes low e and i orbits just exterior and interior to that of Jupiter. These orbits are most similar to those of "quasi-Hildatype" Jupiter-family comets, a group known to strongly interact with Jupiter and experience extended temporary satellite captures. Based on their Tisserand parameters, the orbits are not consistent with a recently escaped Trojan asteroid, but an origin as such is not impossible.