Richard is often shortened to Dick, e.g. as in "Tom, Dick, and Harry".
It's like if another name for John was Frank. It makes zero sense.
https://www.youtube.com/watch?v=9LMr5XTgeyI (CGP Grey)
(spoiler: he couldn't find out where it came from, and did this video on his research to explain more: https://www.youtube.com/watch?v=qEV9qoup2mQ )
Very likely this is due to both being transliterations from Cyrillic.
Oleksander is Ukranian form of Aleksander.
If someone would pronounce Alek and Olek the same, the chosen transcription of the shortened nickname is pretty much arbitrary.
* Jack
* Dick
* Rock from Roland
* Hank from Henry
* Chuck from Charles