Two reasons. First, as others have said, it shows respect. Second, even if you aren't feeling respectful, the judge has a lot of power in his or her court room. Bad idea to show a lack of respect by not standing.
I actually once had a trial where opposing counsel never stood up. Every time the judge got up, I stood up. She made a point of thanking me. Opposing counsel never got the hint. I won the case, not because I stood up, but you better believe it made an impression on the judge, and I am sure she felt more favorably inclined towards me. And if that lawyer ever went before that judge again, you better believe she remembered his behavior.