зачем
- literally 'for what’
- more concerned with goals or actions in the future
- reply usually begins with 'чтобы’ or 'затем, что’
почему
- literally 'by what means’
- more concerned with reasons, causes or consequences in the past
- reply usually begins with 'потому что’
For example:
Зачем ты открыл окно? To let in some fresh air.
Почему ты открыл окно? Because I’m cold.
'Зачем’ is also less formal, apparently.