How does UEFI decide whoch efi file to boot into?

Is there like a default EFI file setting or something. I have a disk drive with Linux on it, and multiple efi files. My computer cant boot into it.I have another disk drive with windows and multiple efi files and even folders. How does uefi decide whoch one the boot into. Is it the first one it comes across or what?
Edit: fixed spelling errors