Because of the Sun, Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto, asteroid belt, Kuiper Belt, and Oort cloud.
Most people assume that asteroids go in a straight line. But what many of us forget is that the gravity of nearby planets affect the trajectory of an asteroid. Even a pull of a body as small as the Moon can drastically affect the direction and speed an asteroid is going, even if it's on the other side of the solar system! Also, nearby stars also have a minuscule, but still measurable, gravitational effect.
These effects might only pull an asteroid a couple millimeters in another direction, but over time, these changes add up. Humans don't have enough computational power (yet) to try and compute all these different unknowns. Trying to predict the direction of an asteroid is known as the [N-Body problem](https://en.wikipedia.org/wiki/N-body_problem
Because that requires knowing it's precise trajectory. Even a minute error in readings over the vastness of space an object will travel can change something like an asteroid impacting earth.
They generally can.
When a new object is first observed, all the observations are quite near to each other. Since any measurement has uncertainty, the resulting orbital calculations are uncertain. Think of it like two dots a pencil width apart on a piece of paper. The line from the top of one dot past the bottom of the other isn't exactly the same as the line between the bottoms of both dots. If you get across the room, the distance might be big.
Alas, space is super huge, and we're talking about a lot more than "across the room". Fortunately, over time, we can make more measurements. When you have two dots on different sides of the room, the angle between these two lines is pretty small. Small enough to see if it intersects an Earth-sized object.
Gravity is an attractive force between objects. In space, there are lots of objects. Even at great distances, gravity exists between these objects and a specific object.
Now, the effect is small. Let's say the moon is inadvertently pulling it closer to the Earth only an inch for every mile it travels along its predicted Earth-only trajectory. Doesn't sound like much, huh? Well, if it's passing by the moon then by the time it passes by the Earth it will have gotten 3 miles closer to the Earth.
If it's coming from an asteroid belt, then that 3-miles variance could wind up becoming 300 or even 3000 miles.
The ones we actually know about are not really the problem.
As soon as we have enough observations of an object to know where it is and where it is going how fast, making accurate predictions years and decades and even centuries into the future is relatively easy.
Of course tiny uncertainties add up over time.
One of the most worrisome candidates for striking the Earth is [(29075)_1950_DA](https://en.wikipedia.org/wiki/
(29075%29_1950_DA) an asteroid which has a tiny chance of striking Earth in 2880. It most likely won't but there is a 1 in 9000 chance of it still hitting us.
Mostly when a new object gets discovered that might hit earth, we can keep observing it until we are reasonably sure that it won't be a problem.
The real problem are the objects that we don't know about.
Watching out for potentially civilization destroying Near Earth Objects is pretty much a hobbyist effort by interest volunteers around the globe and we are very far from having discovered all that we could if we put enough resources into the endeavor.
We spend more money on making movies about asteroids hitting earth than on looking for actual asteroids that might hit earth.
Even worse there may very well be potential impactors that we simply won't be able to see until it is too late.
Being able to figure out if the astroid or comet will hit us once we can see it is the easy part, actually seeing it first is a bigger problem.
* space is very, very large, compared to the Earth...knowing whether something will hit an 8000-mile target from a billion miles away isn't easy
* you have to account for the influence of every large object in the solar system, and that introduces uncertainty
* we can barely see the asteroids when they are first discovered, and often don't have enough information to plot an accurate orbit
The biggest issue for earth-approaching asteroids is usually close approaches to earth itself. These make relatively large changes to the asteroid's orbit. Exactly how large depends on exactly how close they come so each close approach greatly magnifies any uncertainty.
Think about throwing a ball up against a flat surface. We can predict where it will go quite accurately. But what if you throw the ball at a circular pole or column. Now, tiny errors in direction will make a huge difference in where the ball goes. Every approach to the earth (or other massive body) is like a ball bouncing off a pole and the uncertainty quickly becomes huge.