I have historical data where the CPI and GDP are correlated. Does this make sense? If not, how do I test for it?
There was a degree of economic stability between the UK's exit from the Exchange Rate Mechanism in 1992 and the World Financial Crisis in 2008: positive real GDP growth typically between 2% and 4% and low steady inflation typically between 1% and 3%.
The Governor of the Bank of England called this "The Great Moderation".
The effect is what you have observed: the level of real GDP and the level of the CPI both grew, apparently highly correlated with each other, as shown in the red line below based on quarterly data.
But this correlation was an artefact of each indicator growing itself over time and of auto-correlation, as well as not having a recession in that period or sudden spikes in prices; looking from 1991-2009 would have produced a less smooth chart.
If instead you look at the percentage changes over the previous 12 months, the apparent linearity collapses, as shown in the blue line below.
The CPI encompasses the price of consumed goods (some of them are domestically produced, other are imported). The GDP deflator takes into account only the goods produced domestically (some of them are consumed here, other are exported). Thus there is some correlation between the GDP deflator and the CPI as you can see below
Having this in mind, recall that the real GDP is calculated as the nominal GDP divided by the GDP deflator. Thus the price of the domestic goods procuded and consumed in the country are in both CPI and real GDP. Here comes your correlation.