为了 (wèile) and 因为 (yīnwèi) both have the character "为" in them, and they have sort of similar meanings: 为了 means "in order to" and 因为 means "because". Using them properly is important if you want to master Chinese!

为了

为了 can be used to mean "in order to", basically expressing some purpose. In English we may say some things like: "In order to get fit, I will go jogging every day". It can be put in the beginning or end of a sentence, and it can also be placed after the subject.
Structure 1

Examples

Wèi le yǒu yī fèn hǎo ɡōnɡ zuò , tā qù le shànɡ hǎi。
为了 有 一 份 好 工作,他 去 了 上海。
In order to get a good job, he went to Shanghai.

Structure 2
If 为了 is put in the middle of a sentence, it is often followed with an 而.

Examples
All of these examples mean the same thing as the ones above. The different order of 为了 doesn't affect the meaning!

因为

The simplest definition of 因为 is "because". When used at the beginning of a sentence, it is often used with 所以 (which can mean "therefore" or "as a result") to express a cause and effect relationship.

Structure

Examples

Yīn wèi tā xiǎnɡ xué hǎo zhōnɡ wén , suó yǐ tā lái dào le zhōnɡ ɡuó。
因为 他 想 学 好 中文,所以 他 来 到 了 中国。
Because he wants to study Chinese well, he came to China.