Quoting from the debian installation manual:
"...The latter becomes important when booting debian installer on a UEFI system with CSM because debian installer checks whether it was started on a BIOS or on a native UEFI system and installs the corresponding bootloader. Normally this simply works but there can be a problem in multi-boot environments. On some UEFI systems with CSM the default boot mode for removable devices can be different from what is actually used when booting from hard disk, so when booting the installer from a USB stick in a different mode from what is used when booting another already installed operating system from the hard disk, the wrong bootloader might be installed and the system might be unbootable after finishing the installation. When choosing the boot device from a firmware bootmenu, some systems offer two seperate choices for each device, so that the user can select whether booting shall happen in CSM or in native UEFI mode...."
So, disable the legacy mode (also called compatibility mode or CSM) from BIOS and try to boot into the already installed OS, if there is any. If the boot is unsuccessful, the OS on your hard drive was installed in legacy mode and you can't boot or install another system in EFI mode. Else, go ahead and install the OS.