That's because this sentence is backwards. While in English you strictly go for an S-V-O word order, Hungarian is a bit freer in that aspect. Here the object is in front because you want to emphasize it, then the verb, and the subject is more of a piece of background information.
To understand the sentences correctly, you have to identify the roles of their parts by their suffixes. Bírót has a -t suffix, so it's the direct object of the verb vár, and the suffix-less ügyvéd is the subject.
The lawyer is the one who's waiting. You can see that because the noun, ügyvéd, is in its base form.
The judge is the one that the lawyer is waiting for, he is the object of the sentence. You can see it because the noun bíró receives the object marker '-t'.
- A lawyer (subject)
- is waiting for (verb)
- a judge (object)
- Egy bírót (object)
- vár (verb)
- egy ügyvéd (subject)