Would it stop functioning because Disjunction has removed its magic? Or would its spell immunity stop Disjunction from affecting it?
It’s not absolutely clear, but I’d say disjunction doesn’t work on (non-epic) golems.
Ultimately this is a GM’s call (I’ll explain exactly why later): there is precedent for golems not being affected by disjunction at all, but there is also a counter-argument for them being affected. I’ll go through the factors one by one, because I didn’t reach this conclusion for the reasons I thought I would.
Immunity to Magic doesn't grant immunity to disjunction.
Golems (except for the epic ones) are only immune to magic that can be stopped by spell resistance.
Immunity to Magic (Ex): An iron golem is immune to any spell or spell-like ability that allows spell resistance. In addition, certain spells and effects function differently against the creature, as noted below [but none of them is dispel magic or disjunction].
However, mage's disjunction does not allow spell resistance, so immunity to magic won't stop it.
Constructs are immune to many things, but disjunction is not on the list.
Constructs are immune to charms, compulsions, phantasms, patterns, and morale effects, as well as poison, sleep effects, paralysis, stunning, disease, death effects, and necromancy effects, critical hits, nonlethal damage, ability damage, ability drain, fatigue, exhaustion, or energy drain, and most effects that requires a Fortitude save.
Disjunction is not any of these things, so this doesn't stop it.
Disjunction doesn't target creatures.
All magical effects and magic items within the radius of the spell, except for those that you carry or touch, are disjoined.
Since the golem is a creature--it has all the things a creature wants or needs, mechanically: ability scores, hit points, defenses, attacks, and so forth--it is reasonable to say that disjunction doesn't impact a golem any more than the spell would kill a displacer beast.
But... golems are made with an item creation feat
Disjunction does target magic items. Golems are made using the item creation rules, and you need an item creation feat to make one. By that logic, disjunction would turn a golem into an expensive pile of fancy parts.
So it's a GM's call.
If golems are just creatures, then disjunction won't work on them.
If golems are also magic items, then disjunction can kill them.
But I'd say it doesn't work.
And as precedent, I cite the anti-magic field.
While a magic sword does not function magically within the area, it is still a sword (and a masterwork sword at that). The spell has no effect on golems and other constructs that are imbued with magic during their creation process and are thereafter self-supporting (unless they have been summoned, in which case they are treated like any other summoned creatures).
In an anti-magic field, magic items have their magical functioning suppressed as if dispelled, but golems work fine. I think that provides fine precedent for golems not being magic items, and thus not being affected by disjunction.
If you really want to keep some of the power of disjunction in this situation, I’d take the spell’s percent chance to unmake artifacts and make it work on golems too.
Golems aren’t deactivated by antimagic field or Dead Magic Zone. If the complete lack of magic doesn’t stop their animation, it doesn’t seem like a momentary (albeit powerful) disruption should either. Disjunction affects golems the same way it affects any other creature: it kills their spells and magic items. It does not affect the golem itself.
Disjunction separates the item from the components that made it, unmaking it entirely. The magic sword would be separated from the components that made it magical and become a normal sword. In like manner the golem's parts would be separated and it would cease to function, not because the magic was removed but because it was unmade. Though of course the Golem does get a will save to negate.
The Sage says Mordenkainen's disjunction has no effect on creatures
The Dragon #319 Wizards Workshop column “Sage Advice: Tough Questions: Official Answers” includes this exchange:
One of my players tried to use Mordenkainen’s disjunction on a golem. The spell failed to get through the antimagic field provided by the golem’s creator, so I didn’t ave to make a ruling this time. My question is, would it have worked? Is a golem more of a creature, having been listed in the Monster Manual, or a magic item, as it’s created just like one? On that subject, a golem is immune to magical effects, would this include Mordenkainen’s disjunction? That is, is a golem a magical effect for purposes of resolving a Mordenkainen’s disjunction spell?
You can’t disjoin a golem because a golem is a creature, not a magic item or magical effect. Anything that has both a Charisma score and a Wisdom score is a creature, not an object. Mordenkainen’s disjunction would destroy any magical effect a golem was using, such as a slow effect from a stone golem.
This exchange is reprinted in the D&D Frequently Asked Questions (103). The Sage at the time is Dungeons & Dragons, Third Edition co-designer and Monster Manual author Skip Williams. Although the Sage's rulings are often the subject of controversy (see this question), this DM agrees here with the Sage's ruling.