Yes that's the main potential problem you turn it into lots of smaller asteroids. If they are small enough, one or two meters, then they might all burn up in the atmosphere, but otherwise, you may be making the problem far worse. But with a big enough nuclear weapon it could work.
Russians and Americans experts together came up with a plan for nuclear weapons which could break apart a 1 km asteroid and deflect a larger asteroid A new use for nuclear weapons: hunting rogue asteroids
See also Stephen Clements' answer - why not build an Orion space craft and use that to just push it out of the way :).
However, chances are that we can use a much more gentle approach.
With a big asteroid like that, chances are that it does many flybys of Earth before it hits, because Earth is a tiny target. For instance, probably at the time of the dinosaurs, if there was anyone to look up, they must had at least a few flybys - a bright star zipping overhead every few decades - before the time came when it hit the Earth. And probably if they had our technology they'd have been able to spot it maybe even centuries or thousands of years before it hit.
What's more, there's nothing that big that's in a suitable orbit to hit Earth in the near future that we know about. I'm talking here about the ten kilometer or larger size of asteroids (similar in size to Mars' tiny outer moon Deimos ).
Mars's smaller outer moon Phobos, 15 by 12 by 11 km in size, the asteroid that brought an end to the dinosaurs was about this size. If it was a Near Earth Asteroid, this big, surely we'd know about it already, though smaller ones could escape detection.
Comets this size or larger pass through the inner solar system from time to time but are very unlikely to hit Earth on their first pass by because it is such a tiny target. You'd expect at least a few flybys first. And the evidence of impact craters in the inner solar system shows that this is about the maximum size that has hit Earth, Mars, Mercury or the Moon for the last 3.8 billion years - the larger craters are all from the much more turbulent earlier solar system. Larger comets, it seems, all get either deflected to hit the sun or Jupiter or broken into smaller pieces by Jupiter's gravity during their occasional close flybys of the largest planet in our solar sytem.
There are objects that big that could hit Earth in the very distant future.
433 Eros is the second largest Near Earth Asteroid 34.4×11.2×11.2 km - a bit bigger even than the dinosaurs meteorite - and it has a 50% chance of hitting Earth in the next 100 million to billion years.
But it's not a problem for us right now, it can only hit us if its orbit changes quite a bit first.
If it is a Jupiter family comet, comes in to the inner solar system rarely, so the chance is very small of it hitting Earth. And if it comes from the outer solar system, very unlikely to be in same plane as Earth and likely to be like Halley's comet.
As you see, it can never hit Earth because it's orbit only crosses the plane of the Earth's orbit when it is about as far away as Venus, far closer to the sun.
So, - if you had a comet that came into the inner solar system for the first time, not likely it is in the same orbital plane as Earth. It needs to be deflected into the same plane first, which it could do with flybys of Jupiter (say). But those tend to break it up, or may deflect it so it escapes the solar system or hits Jupiter or hits the Sun, or grazes past it so it melts away.
So - likely to be lots of quite distant flybys in that case before it comes near to Earth.
Even for a Jupiter family short period comet, or a very large NEO, you probably have several flybys before it hits, because the Earth is an absolutely tiny target.
These are probabilities, can't say it is a certainty, but very likely.
Then in that situation, for each flyby before it actually hits, it has to fly past Earth through a particular "keyhole" region close to Earth. If you can get it to miss any of those keyholes, then it won't hit Earth.
So - when they talk about asteroid deflection strategies, normally is based on that assumption. Have several decades of advance warning and many flybys first, or at least one flyby before it hits.
In that case you just need to change its delta v by maybe a fraction of a meter per second, a long time before the flyby so it misses the keyhole, so then misses Earth next time around (or several flybys into the future).
So then you can use quite gentle methods. Ideas include a gravity tractor, or nudging it, kinetic impact, lots of ideas. This is the "gravity tractor" - like an ordinary orbit but continually offset just a bit away from your asteroid enough to pull it slightly. You might think - how would that make a difference? But do it continually for weeks and months on end and this can make the necessary fraction of a meter per second velocity change which is all that is needed for it to miss its keyhole.
For other ideas see Asteroid impact avoidance
So we might not need our nuclear weapons. More like a useful tool to have in our arsenal than one we are likely to use. If we do need them, we would have some legal obstacles in the form, particularly, of the nuclear test ban treaty for nuclear weapons. But surely we can agree globally to waive that treaty just for this one off use to deflect a meteorite.
(The outer space treaty prohibits putting weapons of mass destruction into space, so that might need to be waved also - though it's actually a weapon to avert mass destruction rather than to cause it, so it is within the spirit of the Outer Space Treaty I think. )
Anyway these huge asteroids are very rare. One in a million chance of a hit in the next century. A "one in a million" probability is often used as a standard of probability so low you can ignore it - though of course when it impacts the whole Earth potentially, you can't ignore even tiny probabilities.
But - it's not at all likely that we get one of these first. The 1 km asteroids are much more common. And the 100 meter asteroids are far far more common than either of those. And 10 meter asteroids even more common, they hit us all the time but typically burn up completely in the atmosphere as a brilliant fireball.
Frequency of small asteroids roughly 1 to 20 meters in diameter impacting Earth's atmosphere in a twenty year period. These are bolides - usually burn up in the upper atmosphere, create a fireball which can be brighter than the sun, but usually almost nothing survives to the ground, or could be a debris field of much smaller meteorites survive.
Example, a leonid fireball brighter than the Moon - but harmless, mostly just burns up in the upper atmosphere. These are far far far more common than the really big meteorites.
So as our detection methods get better we'll eventually be able to detect asteroids of a few tens of meters in diameter, objective is to be able to do that by the mid 2020s. So then - that means surely it's almost certain that the first predicted impact will be one of those. So we can try out deflection strategies with much smaller asteroids first, and then gradually "learn on the job" before we have to tackle one of these huge ones.
But if we did find a huge one headed our way, with not much warning, like a year or two say, very very unlikely - we could use the gigaton nuclear weapons option in that case. So the basic idea is not impossible, just very very unlikely. But the more likely situation is less dramatic for a movie, much smaller asteroids perhaps up to 100 meters or so, and a warning of a decade, or more likely several decades, with plenty of time to deflect it.
Especially as we step up the program to identify more and more of these asteroids sooner and sooner.
If you want to help with this, you can support the B612 foundation with a donation on their website.
You can also sign this petition to increase funding of asteroid detection by 100 times
100x Declaration
See also What are the chances of Asteroid 2012 TT5 hitting the Earth on September 24, 2015? where I talk about ways that we detect these asteroids and ways that we can detect more of them in the future and detect them a long time in advance.
See also my new: Giant Asteroid Headed Your Way? - How We Can Detect And Deflect Them