Why the two-sided test is not UMP
A normal mean is tested at level 0.05 with known variance. The one-sided test rejects for \overline X>\mu_0+1.645\,\sigma/\sqrt n. The two-sided test rejects for |\overline X-\mu_0|>1.960\,\sigma/\sqrt n.
Against the single alternative \mu=\mu_0+2\sigma/\sqrt n, which test has higher power, and why does that not contradict the Neyman–Pearson lemma applied to the two-sided hypothesis?
Against \mu=\mu_0+2\sigma/\sqrt n the one-sided test has the higher power: its critical value 1.645 is closer to the null than 1.960, so more of the alternative density falls in the rejection region. This does not contradict the lemma applied to H_1:\mu\ne\mu_0. That alternative is composite. The one-sided region is most powerful against this particular simple alternative, and a different region is most powerful against an alternative on the other side. No one region wins against both, so there is no uniformly most powerful test of the two-sided hypothesis.