The settlement overlay alternates between "Press C to add one!" and "Press A for auto!" every few seconds.
When the player presses the A key while the settlement overlay is displayed, a construction is automatically selected and begun for them. The A key should have no effect when pressed while a construction is ongoing; it only has an effect when the settlement has no ongoing construction.
The chosen construction should always be an improvement, if any are available, and a unit otherwise.
The logic for choosing the best improvement can be adapted from the set_construction() function in movemaker.py.
The files that will be involved in this issue will be game.py and overlay_display.py.
Just so you don't have to make the decision if you don't want to.