Understandably, it can be difficult to know when to use por or para, as they are both usually translated as 'for', but this general rule can be very helpful:
Por = motive or cause of an action, a reason
Para = result of an action, an aim or destination
Therefore, it helps to think of por as a prepostion which looks back, and para as a preposition which looks forward
Here are a couple of examples in context:
No pudo ir de compras por estar enfermo (reason)
El colegio no está abierto hoy por la nieve (cause)
El regalo es para mi amigo (destination)
Trabajo en una oficina para ganar dinero (aim/purpose)