Having been fired out of the giant Columbiad space gun, the Baltimore Gun Club's bullet-shaped projectile, along with its three passengers, Barbicane, Nicholl and Michael Ardan, begins the five-day trip to the moon. A few minutes into the journey, a small, bright asteroid passes within a few hundred yards of them, but does not collide with the projectile. The asteroid had been captured by the Earth's gravity and had become a second moon.
The three travelers undergo a series of adventures and misadventures during the rest of the journey, including disposing of the body of a dog out a window, suffering intoxication by gases, and making calculations leading them, briefly, to believe that they are to fall back to Earth. During the latter part of the voyage, it becomes apparent that the gravitational force of their earlier encounter with the asteroid has caused the projectile to deviate from its course.
The projectile enters lunar orbit, rather than landing on the moon as originally planned. Barbicane, Ardan and Nicholl begin geographical observations with opera glasses. The projectile then dips over the northern hemisphere of the moon, into the darkness of its shadow. It is plunged into extreme cold, before emerging into the light and heat again. They then begin to approach the moon's southern hemisphere. From the safety of their projectile, they gain spectacular views of Tycho, one of the greatest of all craters on the moon. The three men discuss the possibility of life on the moon, and conclude that it is barren. The projectile begins to move away from the moon, towards the 'dead point' (the place at which the gravitational attraction of the moon and Earth becomes equal). Michel Ardan hits upon the idea of using the rockets fixed to the bottom of the projectile (which they were originally going to use to deaden the shock of landing) to propel the projectile towards the moon and hopefully cause it to fall onto it, thereby achieving their mission.
When the projectile reaches the point of neutral attraction, the rockets are fired, but it is too late. The projectile begins a fall onto the Earth from a distance of 160,000 miles, and it is to strike the Earth at a speed of 115,200 miles per hour, the same speed at which it left the mouth of the Columbiad. All hope seems lost for Barbicane, Nicholl and Ardan. Four days later, the crew of a US Navy vessel, USS Susquehanna, spots a bright meteor fall from the sky into the sea. This turns out to be the returning projectile, and the three men inside are found to be alive and are rescued. They are treated to lavish homecoming celebrations as the first people to leave Earth.

Question: What causes the projectile to deviate from course?
Answer: The asteroid.
Alternative answer: an asteroid passed closely by them