The table in the "Approximate significance of smooth terms" section of the output reports on Wald-like tests for individual smooths. Note that unlike in the gam package (and others), {mgcv} doesn't separate the linear component from the wiggly components of the spline. As such, these tests are for the function represented by the spline.
In your model you fitted something like
m <- gam(y ~ g + s(x, by = g))
which mathematically is
$$
\hat{y}_i = \beta_{g(i)} + f_g(x_i)
$$
where $g(i)$ is a function indexing the group for the $i$th observation. In your case you have 2 smooth functions, and these spline bases used include the linear function within their span. So the test is for the function, and that function could be estimated to be linear.
The null hypothesis in each case is $\text{H}_0 : f_g(x_i) = 0 \; \forall \; x$, i.e. that the null hypothesis is a constant (flat) function- with value 0 for all observed values of $x$.
The p value is the probability of observing the estimate function under the null hypothesis. It is based on the theory of Nychka's (1988) interpretation of confidence intervals for smooths, extended by Marra and Wood (2012). What is done is a slight variant on Wood (2013). These p values have approximately the correct distribution under the null and perform better than a strict frequentist approach.
Note that you have fixed the number of basis functions and hence the EDF of each of your smooths. As such this model is really just a GLM (there is no smoothness selection, and hence no penalisation), but with specialist tests for the smooth functions. As you didn't do smoothness selection, the p values are less approximate than they would be with the defaults.
References
Marra, G and S.N. Wood (2012) Coverage Properties of Confidence Intervals for Generalized Additive Model Components. Scandinavian Journal of Statistics, 39(1), 53-74.
Nychka (1988) Bayesian Confidence Intervals for Smoothing Splines. Journal of the American Statistical Association 83:1134-1143.
Wood, S.N. (2013) On p-values for smooth components of an extended generalized additive model. Biometrika 100:221-228
mgcv
. $\endgroup$