Your brain is basically a teenager. It ignores everything important all day, then suddenly gets ambitious the moment it should be shutting down.
You know exactly what this looks like. The clock hits 11 PM and out of nowhere you are mentally drafting a five-year plan, color coding your sock drawer, and seriously considering whether you could learn woodworking by Thursday. All day you were moving like a sloth through wet cement, and now your brain decides NOW is the time to be productive.