I'm not claiming to give a full answer; I did learn about this topic, but I don't remember the specific example.
However, there is one answer which works in general.
In Judaism, the concept of gilgulim/reincarnation is that a person can come back into this world in order to fix up, or accomplish something, which wasn't done properly in a previous life.
If a person fulfilled their purpose and lived as a perfect tzaddik (righteous individual) they would not be coming back as a gilgul.
So it would make sense that Rabbi Akiva would come back as a gilgul to fix up something which Cain needed fixed.
What that is specifically I'm not claiming to know.
One other point- in Judaism we don't view Cain as an "evil figure."
Cain committed a sin, a grievous sin of murder and fraticide, it's true.
But he also is the first recorded penitent in human history.
He teaches us how to do teshuva (repent) for our sins.
The gemara states (I think maseches Sanhedrin, but I don't remember off hand- I need to look it up) that Adam Harishon (Adam the first man) thought that he was hopeless after sinning with the fruit of the tree.
He thought that he had permanently distanced himself from G-d, that he was unredeemable.
Whereupon he met Cain, who had just repented for his sin. Cain told him about the power of teshuva, how a person can come back to G-d even after sinning. That causes Adam to do teshuva as well.
So we don't view Cain as this evil, irredeemable figure. Rather he messed up and did teshuva. This actually fits well with R' Akiva, who teaches us that even a person who starts growing and learning late in life can become great. It's never to late to start again. (R' Akiva was 40 years old when he started learning Torah.)
I acknowledge I didn't answer your question specifically, but I think in general terms I addressed your underlying question. Without addressing how they are connected, you can know at least appreciate and understand how they could be connected at all.