In prison, you have people totally isolated from society, many for a long damn time, and some are actually interested in doing things that improve their lives and of course pass the time.
Becoming the best chess player, or the best basketballer, or whatever, on the "yard" is something to aspire to, and if you have something of value to offer these convicts that helps them achieve these goals, they will respect that and pretty much leave you alone since you are helping them.
This is how my chess playing helps me...it makes them better. The only way to get better in chess is to either study hard via puzzles and books (boring) or play someone better then you (fun).
But the same thing happens in the law libraries or even the computer labs...in the music rooms and on the football fields. Talent is always recognized and smarts are in short supply in general.
Not much different from the tech world huh?