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
