The 24-hour day feels fundamental, but it’s actually changing. Earth’s rotation is slowly slowing down, and every century, a day on Earth gets about 2 milliseconds longer than the century before. It’s a tiny change, but over hundreds of millions of years, it adds up.
The cause is the Moon. The Moon’s gravity creates tides on Earth’s oceans, and the friction from those tides slightly drags on Earth’s rotation, gradually slowing it. We have evidence of this from ancient corals - coral skeletons grow distinct daily layers, and by counting layers in fossil corals, scientists have figured out that 600 million years ago, when those corals lived, a day on Earth was only about 22 hours long.
The slowdown continues into the future. In about a billion years, an Earth day will be roughly 30 hours. Eventually, way out in the distant future, Earth’s rotation will be so synchronized with the Moon that a day on Earth could last 47 hours - equal to a month, with the Moon hovering over the same spot on Earth permanently. The Sun will probably have burned out long before that fully happens, but the principle is what matters: nothing is fixed.