Both are indexes that combine survey data on the perception of corruption. Their main difference is which indicators they combine and how they do it.
CPI uses a smaller set of sources than WGI. For historical reasons, they also combine the indicators in a rather particular way and until recently, you could not use their index to make any comparisons over time (which is still the case for the CPI data before 2012).
WGI uses a larger dataset on corruption. While the method it uses to combine those indicators is a little more complicated (an unobserved components model), it is also a lot more robust to various issues that plague the underlying indicators. Overall, for scientific research I would recommend using the WGI over the CPI, as it is a higher quality index. Moreover, they also consistently provide an estimate of the uncertainty of their index values (e.g. due to missing data), allowing you to take this into account.
When using the WGI to make comparisons over time, it is useful to point out that they normalize their indicators in each year. This means that if the level of corruption worldwide improves, this would not be picked up by WGI. There are indicators out there that are more useful in panel datasets (one of which I constructed: the Bayesian Corruption Index).
Rohwer, A. (2009). Measuring corruption: a comparison between the transparency international's corruption perceptions index and the World Bank's worldwide governance indicators. CESifo DICE Report, 7(3), 42-52.
What they share is the entire redundancy caused by unilateralism: of course US scientists do not see themselves to being corrupt. But we see it.
Funny samples from the CPI (column G) is Luxembourg on rank 9 of the less corrupt countries. Of course Cayman, Jersey and Monaco are as well not corrupt. You are only corrupt when you're poor. In tax heavens you pay the entire state, not single officials.
The Corruption Perceptions Index (CPI) is an index which ranks countries "by their perceived levels of public sector corruption, as determined by expert assessments and opinion surveys." The CPI generally defines corruption as an "abuse of entrusted power for private gain".