@STW has the right idea, but I think it's worth noting that to the extent possible, you're trying to hold your upper body still, and (especially when sprinting) you "wobble" the bike under you to maximize power. In other words, most of the "wobbling" involved is less of an accidental side effect than something they actually work at. Conversely, when you see somebody whose upper body is moving a lot, while the bike stays relatively upright, it's a pretty good sign that they're running out of energy.
There are some other (also intentional) reasons as well. First, working your way through a tight peloton can be tough, especially close to the finish. Most of the riders are staying as close together as they can to get maximum drafting. Worse, unless they happen to be your team-mate, the people right next to you will often try to "squeeze" you to intimidate you enough to slow you down a tiny bit. Here you're literally "throwing your weight around" to make it harder for others to squeeze you in.
Likewise, the "smoother" you ride, the easier it is for somebody to draft off of you. The more you're moving sideways, the harder it is for them to get/stay in your draft. Earlier in a race (like in a breakaway) you'll see people do relatively quick sideways movements of the bike to help drop people drafting off of them. In the final sprint, you usually can't afford to do that, but you're still doing the best you can to make drafting difficult, as long as you don't slow your self down (much) in the process.
Finally, if you're riding smoothly, it's fairly easy for somebody to stay close beside you and stay in your draft almost until they're in front of you. By moving around as much as possible, you force them to pull farther to the side before they can pass safely, which means they lose your draft and have to do more of their own work to pass.