tr does not match patterns. It works character by character. Both of args to tr end with "jpg". That means translate "j" to "j"; "p" to "p"; and "g" to "g". tr will never know that the string "jpg" appears in the data.
Notice how the character zero appears more than once in the strings. That is a clear sign that you are still thinking in patterns. tr will never assemble 4 consecutive characters like "2005".
Basicly, break your string into 3 pieces, upsihift the middle one, and reassemble the whole string. How depends on what shell you're using. ksh can do everything with just shell builtins thanks to the magic of "typeset -u". With other shells it may be harder.
It should be quite easy in shell.
If you want speed though write a sed program
Here's a start...
echo "p-20050608-Ajyd-g.jpg" |
sed -e '
{
#keep orig path in hold space
h
#put 3rd bit in pattern space
s/\(.*\)-\(.*\)-\(.*\)-\(.*\)/\3/
#lowercase
y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
#exchange pattern and hold space
x
#first bit
s/\(.*\)-\(.*\)-\(.*\)-\(.*\)/\1-\2-\4/
#capitalised bit
G
}' |