I have Linux kernel source code. If I build and install it, how will operating system know that it has to use that kernel.
I have a kernel 5.3, if I build XYZ kernel, how OS will understand to use new kernel or old one. And what if the new kernel has a bug.
When you install the kernel, a new bootloader config file is generated, so that the bootloader is aware of your new, shiny, kernel. In many distributions the most recent kernel installed is placed at the top of said config file, so it will be chosen by default if you don't press
Esc (or another key, depending on the loader). How you can boot another kernel if the default one doesn't work for you depends on the bootloader. In GRUB, you press
Esc after firmware (BIOS) and you will get a list of available kernels.