Many factors impact the answer.
If I said “3 am” and you hated getting up at 3 am so much that you never exercised you would do a whole lot worse than if you had just exercised when you got up naturally. Of course 3 am would be a weird time to exercise in any case, but you see my point. Choose a time of day convenient for you to do your exercise and it will help you build a habit.
Where do you live, and do you like outdoor or indoor? If you live in a desert area where it is cooler in the morning for example and you like to run, you might do well running earlier in the day. There are quite a lot of environmental aspects to exercise if you like to go outdoors.
If you like indoors, and go to a gym, you have to look at the times the gym you attend is open. Choosing a gym will be a combination of whether the times available work for you, and whether the programs and equipment work for you.
What kind of exercise? Personally I prefer not to do cardio too late in the day as it makes it a bit hard to sleep, though a short walk can be helpful. Yoga is nice in the evening, if it is not too much of a power class.
I have taught classes from 5 am to 8 pm. There are some differences. Early in the morning the body is a little tighter, but I find the energy is good. It is a great way to start the day, and I find aids with mental focus through the morning. A class before a light lunch helps refocus the mind, and seems (not citing research, but my own experience) to be helpful in making more healthful choices with lunch. After work classes are really nice for letting go of the stress of the day, and seem to help with sleep.
I am sure there is research on this, and if you are the kind of person who will exercise no matter what and is training to get the maximum edge for some competition, or something like that you should be able to find that. But for the average person trying to get strong and healthy finding what works for you in your situation is usually a good way to go.