How to rename the set of files with pattern

Try

rename -n 's/50(_.*)_8/21$1_3/' *.csv

The -n flag doesn't do any renaming. You can test patterns this way. Remove it for actually performing the renaming.