"To" can indicate movement towards a place. He beat me to the car. = He arrived first at he car.
the punch = the action of punching
"To" can also indicate movement toward the accomplishment of an intention, or a result
He beat me to the punch.= He beat me to the action of punching. He punched first.
We were both trying to punch and he accomplished it first.
They came to my aid. = They came with the intention of aiding me.