Minecraft wiki entry for Iron_Golem, associated text: A naturally-spawned iron golem knows where raiding illager locations are from behind solid walls and from underground and attempts to move toward them. An iron golem created by the player or summoned by a command cannot detect raiders through obstructions. Iron golems also looks down or looks up if the hostile mob is above or below the iron golem.