that was because of 2 simple reasons
1 - Transformers was a MAGINFICENT SPECTACLE to watch.. Even the villians had more personality and charisma than heroes...Especially Lockdown was just brilliant CG.....xmen was absolutely great but wasnt on that level....
2 - i have been watching transformers for 20 years, extra emotional attachment..after the extreme crap of last 2 movies,optimus was finally what he was destined to be, an inspiring leader.. "To die for" (quote)
also, xmen had a standard bollywood happy ending, which it shouldnt have been since comic series is killing wolverine in "death of wolverine" by next month,.. Transformers ending left a lot of suspense , Alpha trion, the creators, the lost knights, rebirth of cybertron, so much suspense..., just like the 1st avenger movie Thanos scene.
no doubt xmen was awesome mind blowing fantastic movie, , i just couldnt find my lower jaw while watching transformers...(found it rolling under the bed after the credits)