When you remove a server from a load balancer, you have two problems happening at the same time. The load balancer needs to stop sending new requests to that server, and the server still has requests it is in the middle of handling. If you yank the server immediately, every one of those in-flight requests gets killed, and the user sees a 502 or a connection reset.
Connection draining solves the second problem. Instead of cutting the server off instantly, the load balancer marks it as draining, stops routing new requests to it, but keeps existing connections alive until they finish or a timeout expires. Once the server has no active requests left, or the timeout is hit, the load balancer removes it cleanly.
The setting is almost always controlled by a single value: a drain timeout, often called the deregistration delay. AWS Application Load Balancer defaults this to 300 seconds. NGINX and HAProxy call the equivalent state a server going into drain or maintenance mode.