Conventions: I will use 漢字 to represent Chinese words, and かな or [振り仮名]{ふりがな} to represent Japanese words.
なす/なる and “to make”
為 is related to (and might have been the same as) 偽, “to forge”. Both なす and なる happens to translate to “to make” in Chinese.
When you make “an object” you produce it. Sometimes the active and passive distinction in Chinese is not so clear, e.g.
漢文:氷、水為之、而寒於水
[書下]{かきくだし}し:氷{こおり}は、水{みず} 之{これ}を為して{なして}、而も{しかも}水{みず}より寒し{さむし}
Also: 氷{こおり}は、水{みず} 之{これ}と為りて{なりて}、而も{しかも}水{みず}より寒し{さむし}
Translation: “water makes ice” or “water turns into ice”
The difference is not clear.
なす/なる and “to do”
When you make “an action” you do it. When you try to do something, you 為す{なす}. When something is done, it 成る{なる}. 為 is the process while 成 is the result. It's similar to the difference between “look” and “see”. This distinction does not exist in Japanese. なす usually implies なる.
為すべきは人にあり、成るべきは天にあり
為せば成る
Translation: where there is a will, there is a way
“To do” and “purpose/reason”
In Chinese, there is no question word meaning “why”. “Why” is expressed as “what to do” (何為 or 為何). Coincidentally, Japanese sometimes says “what to do” to express “why”, too, e.g. ~なんすれぞ(archaic) なにしに and どうして.
何為ぞ{なんすれぞ}、去らざるや
なにしに、悲しきに見送り[奉]{まつ}らむ
どうして、去らないのか
why don't you leave here?
何しに来たんだ
What did you come here for?
ため and “purpose/reason”
I think ため means “benefit”.
~ために、~する means to do something so that it helps something else. The grammar is straightforward, too. When you say “~を~にする” the result is “~が~になる”.
Conclusion
ため, する and 為 share the same meaning “for”.
する, なす, なる and 為 share the same meaning “to do”/“to make”
All the four words (ため, する, なす and なる) end up with the same kanji representation 為.
A little more
It's not uncommon to see words meaning “be made” develop into copulas. 為 is also a copula in Chinese. In this case, it's read as たり, which is a contraction of とあり.
漢文:為人臣者
書下し:人臣{じんしん}たる者{もの}
Translation: someone who is a servant