TCP window scaling adjusts how many un-acked packets can be in transit before it stops and waits for an ack.
On a high latency connection (like one over the Internet), a very small window would slow it to a crawl. The sender would send a couple packets, then wait a long while for the ack before sending more. However if that connection also corrupts packets now and then, too large a window is bad too. On an error, the receiver sends a nack, then drops subsequent packets. The sender then retransmits everything from that packet onward. The larger the window the more has to be re-sent.
So the kernel automatically scales the window size. It begins with a default size. Then if it ends up waiting for acks before sending more, it increases the size because of high latency. But then if there’s an error and it has to retransmit, it decreases the size. The idea is to dynamically tend toward an optimal size for this particular connection.