BEGIN{OFS=FS=","} sets input and output field separators to ,.
NR==FNR is only true for the first file. So, for the first file:
a[$1]=$2 put $1 as index and $2 as value in array a.
next skip the remainder of the script for this line.
Again: next means that the remainder of the script is only executed for the second file (and third, fourth, ... files if they were present).
$3 in a && $3 = a[$3] If the third field is a key of the array a,
replace the third field with a[$3]. Now, since this is not in an action environment (i.e., not inside {}), it means that if both conditions
are true, the current record should be printed. Otherwise, nothing is to be done.
Generally, since the condition on the right is an assignment, that will result in true if
the left side is true. However, the assignment is evaluated as false if it assigns
an empty string or the number 0. This may be intended, but it is usually an edge-case
that the programmer failed to notice. To see it, try the awk code with
filez:
111,111
112,114
113,113
000,000
filex:
A,bb,111,xxx,nnn
A,cc,112,yyy,nnn
A,dd,113,zzz,ppp
A,ee,000,uuu,aaa
Notice that, for the last line, although $3 in a is true, $3 = a[$3]
assigns to 0 and thus the line is not printed!
$ awk 'BEGIN{OFS=FS=","}NR==FNR{a[$1]=$2;next}$3 in a && $3 = a[$3]' filez filex
A,bb,111,xxx,nnn
A,cc,114,yyy,nnn
A,dd,113,zzz,ppp
On OP request for clarification:
Remember: The array is populated with a[$1]=$2 in the first file, filez.
$3 = a[$3] is executed for the second file, filex.
For example: In the second line of filez, a[$1]=$2 -> a[112] = 114. In the second line of filex, $3 = a[$3] -> 112=a[112]=114.