Why do judges rely on law, justice and policy when deciding a case?

Because law, justice, policy are supposed to be fair and unbiased.
Let's assume I'm the judge you and your abusive, drunken bum of a husband appear before me. You want a divorce. The law says you can have one, justice would demand it, and policy (protecting wives from abusive husbands) allows it. BUT, I am a true, fundamentalist christian who believes all marriage is holy. While my religious beliefs would want the marriage to continue, I am constrained by law to grant you the divorce.
The law and its precedents protect you from judges who would inject too much of their own personal beliefs and prejudices into decisions.
The question you are asking is highly debatable.

Google search 'Hart-Dworkin' debate.

Also, it might help to clarify a bit what you mean by ' law,' 'justice,' and 'policy' as opposed to 'a law,' 'a just decision,' and 'precedent.' 'Principles' are also important to consider.
An excellent question. Because Due Process requires that the courts rule on issues presented to them based upon the law that exists at the time. That is legislative enactments.

If there are no legislative enactments or they are not clear on their face (the laws) then judges will interpret the law using rules of construction to test the applicability of the law.

In the absence of a law, they will rely on precedent or 'stare decisis' which are rulings that have previously interpreted rights and obligations of persons or parties under the common law.

Finally, they will consider public policy issues when matters are brought before them which have unique facts and issues. Such as the enforcement of gambling debts in a state that has a public policy of not doing so, for the welfare of its citizens.

Each one of these analyses is designed to, at the very least, ensure that the Constitution is complied with in a proper and orderly manner, giving each side an opportunity to make its arguments and to have notice of the claims, defenses and resolutions applied to the case.

What's the alterntive? Judges who decide cases on political, moral or religious beliefs. Or worse yet, judges who decide cases based on how much money they get paid by one side or the other.

Personally, I'd go for the system we have. In theory its supposed to work, and in practice it often does.
That's the law. They have to go by the laws.
because law is cmpilation of norms, customs and practices deduced from certain soceity and period reasonable enough as basis of justice and policy so that either party of a case will be given due consideration of their grievances or penalty that is acceptable by their conscience.
Because, thats the way it is.
Not, necessarily, the right way.


Answer:
Because most laws are based on precedent. 'Stare decisis'...let the decision stand.