This is the 16166th most frequent Polish word.
ulegać
"Ulegać" means "to succumb," "to yield," or "to undergo."
In this sentence, 'ulega' means 'undergoes', describing a physical change in the material.
Materiał pod wpływem ciepła ulega rozszerzeniu.
The material expands under the influence of heat.
Here, 'ulegam' is used to express succumbing or yielding to a temptation.
Czasami ulegam pokusie zjedzenia słodyczy.
Sometimes I yield to the temptation of eating sweets.
In this case, 'uległ' signifies that the building underwent destruction, indicating a consequence of an external event.