It sort of depends. Chances are, it's bad. However, there are forms of tofu that have a sour smell on purpose.
Fermented tofu products don't smell sour: they stink pretty intensely, more like a very stinky blue cheese than anything else, but not much like that. Doesn't sound like what you were dealing with.
Certain styles of ultra-fresh tofu are made with large quantities of coagulant, and in some cases the coagulants have a distinct sour smell and taste. These coagulants are not effective preservatives, however, so any such product would be clearly marked as "fresh" and have a use-by date no more than 4 or 5 days after it was made in the first place. This is very rare in the U.S. -- you'd have to look for it.
If you're looking at a common brand of packaged tofu, e.g. Nasoya or something like that, or any kind of relatively "standard" tofu packed in water at a Chinese market or the like, it should not be sour. However, sometimes the water in which the tofu stands can smell sour within hours while the tofu remains fresh. If unsure, drain the tofu, rinse it gently in cold water, and then smell it again. If it still smells sour, don't eat it.
The problem is that "tofu" is not just one thing -- it's a whole range of products made of more or less coagulated soy milk. The traditional coagulants have taste, the methods of coagulation produce taste, and so on.
The thing is, fresh tofu is mediocre at best after 3 days, and downright yucky in a week, but you could eat it and it wouldn't hurt you for quite some time. All other kinds of tofu have preservatives in them, and most pre-packaged tofu has scads of preservatives. So it's surprising to run across standard US-style tofu that's actually off unless it is WAY past its use date.