Because the program doesn’t respond, really.
Windows talks to applications by sending them messages. They’re supposed to regularly ask Windows “what’s the next message I’ve received?”, and then act on that. Messages may be as simple as “the user pressed this key on the keyboard”, or “the mouse is now at this position”, or “the user would like to close this window”, or a number of other, more technical things.
But this means that there’s a constant stream of messages being sent to the application, and if the application never asks Windows for the next available message, Windows knows that something’s up. If the application doesn’t ask for these messages it can’t react to user input, and so it’s basically hung. So if an application hasn’t checked in and asked for messages for a couple of seconds, Windows flags it as “not responding”.
Latest Answers