Why are the correlations in two groups less than the correlation when the groups are combined? I have been running correlations for a set of data and several subsamples. 
During this analysis I ran into a situation where the $r^2$ for two groups was smaller in each individual group as opposed to when they are grouped together. 


*

*Is there any straight forward explanation for how this could happen?

 A: Here are just a couple of ideas:

*

*Range restriction is one explanation.  Check out this simulation;  and this explanation.

*Correlated group mean differences is another related idea. Say group 1 has a mean two standard deviations higher than group 2 on both X and Y, but that there is no correlation between X and Y within each group. When you combine the two groups there would be a strong correlation.

And just for fun, here's a little R simulation
# Setup Data
x1 <- rnorm(200, 0, 1)
x2 <- rnorm(200, 2, 1)
y1 <- rnorm(200, 0, 1)
y2 <- rnorm(200, 2, 1)
grp <- rep(1:2, each=200)
x <- data.frame(grp, x=c(x1,x2), y=c(y1,y2))     

# Plot
library(lattice)
xyplot(y~x, group=grp, data=x)

# Correlations
cor(x1, y1)
cor(x2, y2)
cor(x$x, x$y)

Which produced these three correlations respectively on my run of the simulation
[1] 0.1248730
[1] 0.1027219
[1] 0.56244

And the following graph

A: Sounds like Simpson's Paradox.
A: 
During this analysis I ran into a situation where the $R^2$ for two groups was smaller in each individual group as opposed to when they are grouped together. Is there any straight forward explanation for how this could happen?

Yes, this simply means that knowing to which group the observation belongs to explains part of the variation of $y$. You should consider interacting $x$ with the group variable in your modeling. For instance, in Jeromy's example, once conditioning on group, $x$ is independent of $y$ --- the group is the main explanatory variable of the variation of both variables.
A: The phenomenon relates to the geometry of linear regression analysis
This result is quite common in regression, and it reflects the fact that each new explanatory variables generally gives some additional information about the response variable, so that a model that combines variables from two other models will give a higher coefficient of determination than the latter models.  That is, if you have two separate models with coefficients of determination $R_1^2$ and $R_2^2$ (using different explanatory variables) and the combined model has coefficient of determination $R^2$ then you have:
$$R^2 \geqslant \max(R_1^2,R_2^2).$$
Usually the coefficient of determination in the combined model is no greater than the sum of the parts, so you will usually have:
$$R^2 \leqslant R_1^2+R_2^2,
\quad \quad \quad \quad \quad (\text{Common case - no enhancement}),$$
but it is actually possible that it may even be higher than this
$$R^2 > R_1^2+R_2^2,
\quad \quad \quad \quad \quad (\text{Rare case - enhancement}). \quad \quad \quad$$
You can read more about the geometric properties of regression models and the resulting effects of combinining variables in O'Neill (2019).  That paper discusses the relationship between the coefficient of determination in the combined model and the coefficients of determination in the individual models using the same explanatory variables.  The paper also discusses the phenomenon of "enhancement" where the coefficient of determination in the combined model is more than the sum of its parts.  These relationships depend on the eigendecomposition of the correlation matrix for the set of variables in the regression, so there are some quite complicated relationships at issue.
