With Android 10, Google got around to finally adding a system-wide Dark mode to the OS. However, the company did not add an option to automatically enable or disable Dark mode depending on the time of the day or based on sunrise/sunset.
This was an odd omission on Google's part especially since the feature was already present in one of the beta builds of Android 10. The company then went on to remove it citing issues with UI redraw that could lead to scrolling position and entered text in a list vanishing when the switch happens. Chris Banes from Google's Android Developer Relations team also explained that sunset/sunrise time calculations can be extremely difficult leading to poor user experience.
Now, it looks like the next version of Android will add the ability to schedule switching Dark theme on/off. A Dark mode scheduling bug in the Android issue tracker has been marked as fixed by one of Google's engineers, with the feature becoming available "in a future Android release" which will likely be Android 11.
The ability to schedule Dark mode on/off is already present in almost all major Android skins, with only stock Android missing it. Until Google gets around to releasing Android 11 with this feature, you will have to rely on a third-party app like this to get similar functionality on your phone.