U counts, over every pair with one value from each group, how often the first group's value is larger, with ties counting half. Divided by n₁ × n₂, it is the probability that a random value from one group beats a random value from the other, the same quantity as the AUC of a classifier. It is also called the Wilcoxon rank-sum test; Henry Mann and Donald Whitney published their version in 1947, two years after Frank Wilcoxon's.
Example: group A is 3, 5, 8, 12 and group B is 1, 2, 4, 6. Of the 16 pairs, A wins 13, so U = 13 and A beats B 81% of the time, though with four values per group the exact two-sided p is 0.2. Change A's 12 to 120 and U and p stay exactly the same, while Welch's t-test p moves from 0.16 to 0.36.
A common interview trap: it is often called a test of medians, but that only holds if the two distributions have the same shape. It answers whether one group tends to produce larger values. For paired data, such as the same users before and after, use the Wilcoxon signed-rank test instead.