In the broadest sense, both 'por' and 'para' have the meaning of for, but they are used in different contexts and are not interchangeable. I find it helpful to think of it as if ‘para’ involves looking forward or to the future whereas ‘por’ involves looking to the past. This is of course a large generalisation, but it can be a useful rule of thumb if in doubt. The main usages of ‘para’ can be outlined as follows: intention (para + infinitive), movement towards something (ir para españa), deadlines, destinations and opinions (para mí). ‘Por’ on the other hand is used for reasons and causes, movement through something (entrar por la puerta), methods of doing something (llamar por teléfono), as well as introducing the agent of a passive clause. There are of course other usages for each word, including a large number of idiomatic expressions, but these are the most common ones.