Beat Someone to the Punch

What does the idiom “Beat Someone to the Punch” mean?

Definition:

Do something before or faster than someone else

For example:

“I wanted to buy a great used car I saw yesterday, but someone beat me to the punch—today it’s gone.”