Because these words are both translated to English with 'for' it can be difficult to choose between them at times. In order to choose correctly, there are several rules to remember, here are the most important ones:
Por
1) For a duration of time:
Estudié por dos horas - I studied for two hours
2) The reason for something:
Estoy cansado por falta de sueño - I am tired because of a lack of sleep
3) Frequency
Voy al cine dos veces por semana - I go to the cinema two times a week
4) In passive sentences
El edificio fue construido por Juan - The building was constructed by Juan
5) To thank someone for something
Gracias por la ayuda - Thank you for the help
Para
1) Purpose of an action/goals
Estudio para aprobar los examenes - I'm studying in order to pass the exams
2) Recipient
Este regalo es para Maria - This present is for Maria
3) Deadlines
Los deberes son para el viernes - The homework is for Friday
4) Physical destinations
Voy para Chile mañana - I am going to Chile tomorrow
(Note you can also say 'Voy a Chile mañana' here)
There are more situations that require 'por' and 'para' but these are some of the most important ones. To help you remember, think that 'por' generally looks backwards to the reason why something happened, and 'para' generally looks forwards towards the goal or purpose of an action. However, the only way to master these is to memorise the rules and different situations in which you use 'por' and 'para'.