A kernel panic is an emergency protocol executed by an operating system when it encounters an internal fatal error from which it cannot safely recover. It indicates either a bug in the kernel or hardware failure, often requiring a system reboot to resolve.