You should think of this graphically. Even if you have several predictors, the main issue is shown with one response and one predictor where it's perfectly possible to have higher predictability within each group than when you combine groups.
A trivial but instructive extreme case has two groups each of two points with, in each group, different values on the two variables. Then each group is guaranteed $R^2$ of 1 (because the points define a straight line) but the whole isn't guaranteed that at all.
Imagine four points defining a rectangle with sides parallel to the axes and with group A the top right and bottom left points and group B the other two. Then within-group correlations are $1$ and $−1$ but the overall model has $R^2$ of 0.
A picture says it better.
The orange points A and the blue points B both define $R^2$ of 1, quite different from the combined pattern.
My examples are contrived and extreme but clearly I can't see your data to experiment. But your groups don't have to be very different from each other for the effect you observed. Typically a group is more homogeneous (has less scatter) than the whole unless the grouping has nothing at all to do with the variables in question.
This effect is generic for regressions and similar analyses.
More interesting examples are often discussed under headings such as Simpson's paradox. A more direct term would be amalgamation paradox to describe the fact that collective patterns often seem to contradict subgroup patterns.
It is also entirely possible to get the opposite effect, a combined result stronger than any group result, but this is less common in practice.