Each hub has a person who's sole job is managing the gate assignments. There are a lot of complexities that they must deal with due to each gate only supporting some aircraft, the need to keep the zones balances so that there will be personnel available when they are needed, and so that the departures are not bunched up so that they'll all be in each other's way, etc.
When winds aloft are stronger, or weaker, than typical for the time of year, large numbers of flights will arrive early, or late. Other flights are early, or late for their own unique reasons. Early airplanes may arrived well before their planned gate will open. Delayed departures might remain at their gate long after the next flight arrives. All of these issues have to be sorted out and result in gate swaps.
Here's an image of the gate managers gate flow screen from a Denver morning bank that I found on Google Images some years ago. The horizontal bars indicate the time that an airplane is scheduled to be at that gate. The space between the bars is how much slop there is in the gate's schedule to absorb early/late flights.