This is a bit simplistic, but for the sake of brevity (and the fact that there are whole law school courses discussing what I am about to summarize):
Under the separation of powers doctrine, an independent judiciary is supposed to interpret, not make or change, the law.
Only when a law is unconstitutional is the court supposed to change it. But even then, the court is supposed to change it by tossing it out (declaring it unconstitutional), not by substituting a new law in its place.
When a court is accused of legislating from the bench, it is essentially being accused of making laws instead of interpreting existing laws.