I think he's smart enough to realize that gambling on games is something that you can't stop people from doing, so you may as well harness that desire. He's also smart enough not to get ahead of this, knowing that the NBA should be ready, but isn't about to start lobbying openly for it, until it becomes politically desirable.
I'm not sure how the gambling benefits the game, but legalizing it benefits the gambler and the government, as it will bring regulation and inspection. It doesn't make any sense to fight it, simply to fight any corruption in the outcome of a game.
Stern has been pretty good for the league, the NBA puts out a better product and it's not nearly as Nazified as the NFL, who wants emotionless zombies for players.