If your goal is to be a better boxer, and you have to chose one or the other, the heavybag is the obvious choice. But the reality is that you probably don't have to choose. Every major sport has accepted that weight training improves athletic performance with increases in both speed and power. Boxing, for some reason seems to be filled with people that don't understand that simple concept. Most boxers that will warn you to stay away from weights will tell you something like "bodybuilders are slow" but that's an absurd argument because weight lifting and bodybuilding are two very different things. If you have the option, train smart with both and you'll be better off.