Bad means immoral, good means moral.
Morals are the rules that human groups developed in order to survive, live in peace and have happy lives. Nature is, by means of natural selection, what decides if the group's morals allow the group to adapt (or else, it must perish). Good becomes synonym to moral.
If you doubt which are the rules of social interaction that led to the success of human groups, it is morals.
Law and justice should normally be absolutely consistent with morals. However, considering that:
the moral rules of a group are very difficult to test (many generations would be required)...
the fact that each member can interpret moral rules in a different manner, and...
power (including the power to write laws) is subject to interests...
... then, law can be quite different to morals (law becomes a biased interpretation of morals). In other words, not all laws are good.
When laws are not consistent with morals, social disobedience emerges. However, as said, it is very difficult to assess the goodness of a moral rule, and in consequence, the goodness of any law. In case of any conflict, not always the good guys win.
If a law turns to be immoral, or bad, for nature, its application implies that nature will decrease the probabilities of persistence of the group.