Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps. adb provides access to a Unix shell that you can use to run a variety of commands on a device.
android_sdk/platform-tools/.adb command.When you start an adb client, the client first checks whether there is an adb server process already running. If there isn't, it starts the server process. When the server starts, it binds to local TCP port 5037 and listens for commands sent from adb clients.
The server then sets up connections to all running devices. It locates emulators by scanning odd-numbered ports in the range 5555 to 5585, which is the range used by the first 16 emulators. Where the server finds an adb daemon (adbd), it sets up a connection to that port.
Each emulator uses a pair of sequential ports — an even-numbered port for console connections and an odd-numbered port for adb connections. For example:
Emulator 1, console: 5554
Emulator 1, adb: 5555
Emulator 2, console: 5556
Emulator 2, adb: 5557
and so on.
As shown, the emulator connected to adb on port 5555 is the same as the emulator whose console listens on port 5554.
After these steps we run our command for example adb shell whoami. The ADB binary connect to ADB server, The ADB server get the command and send it to ADB daemon and wait for response. ADB server get response and forward it to the ADB binary.

This alert if asking permission to allow the PC/Laptop to connect to this android device. The RSA key which is used for authorizing is stored in both PC/Laptop and android device. To seeing these keys in you PC/Laptop:
/home directory