Para expresses purpose or intention (“in order to…”). Here you’re stating your reason for arriving early: para evitar el tráfico (“in order to avoid traffic”).
Using por in that spot would change the meaning or sound ungrammatical—you’d need a different construction (e.g., por el tráfico, meaning “because of traffic,” but that doesn’t express your goal).