In Minitab statistical software the printout for the z-test is shown below:
Essentially, your are comparing $\hat p_S = 0.135$ in your sample with
$\hat p_C = 0.007$ in the complement of the sample. Sample sizes are large
enough to find that these proportions are significantly different.
The difference
$\hat p_S - \hat p_C$ is approximately normally distributed. When you divide
by an estimate of the standard deviation of this difference, you get a
test statistic $Z$ that is normally distributed. Here $Z = -17.66$ and you
can reject the null hypothesis that the two proportions are equal.
I suppose you can find a formula for this test in a statistics textbook
under 'Categorical Data: tests for two proportions'.
The last line of the output shows the results of Fisher's Exact test.
You can find a description of that test on Wikipedia, if not in a textbook.
Test and CI for Two Proportions
Sample X N Sample p
1 25000 3497600 0.007148
2 300 2200 0.136364
Difference = p (1) - p (2)
Estimate for difference: -0.129216
95% CI for difference: (-0.143556, -0.114876)
Test for difference = 0 (vs ≠ 0): Z = -17.66 P-Value = 0.000
Fisher’s exact test: P-Value = 0.000
If you do a test for independence in a two-by-two 'contingency table' as
described in my Comment, you will reject the null hypothesis that
categories Sample/Complement and U/non-U are independent.