に代わって => instead of; replacing; on behalf of ~ N3
代わりに => instead of; as a substitute for​; in exchange for; in return for N3
[代「か」]わり => Not A, but B, B in place of A, Instead of A, B; In exchange for A, B N3
Comparison, Exchange
に行く/に来る/に帰る => go/arrive/go back (to do something) N5
へ => Go to N, head to N , Often followed by verbs like 行く/いく, 来る/くる, 向かう/むかう… N5
Particles