It's an instinct from when they were feral, before we domesticated them. The days getting shorter means the weather is not going to be good for hatching eggs and raising chicks. So they stop laying eggs when the days get shorter. It has nothing to do with how cold it is likely to get where you are now, it goes back to where they were when their ancestors were feral.
Since their feathers wear out and they will need good feathers during the cold weather they take advantage of the opportunity to molt. They use the nutrition that is no longer going to make eggs to replace their worn out feathers. Again, nothing to do with how cold it might get where you are.
When we domesticated them we bred some of them to lay a lot more eggs and to not go broody as much, along with many other things. Many immature chickens, male and female, no longer molt their first fall/winter. Some pullets continue to lay through their first winter. Some, not all.
With living animals you can always find exceptions to practically anything, even this. But the vast majority of chickens have retained the instinct to stop laying and molt when the days get shorter. That's why commercial operations carefully control the length of days with artificial lighting so the days don't get shorter and throw them into a molt until they need to.