By 1,500 BCE, Egyptians were using sundials to divide the period of daylight into 12 segments. One explanation for their choice of 12 comes from their recognition there are about 12 lunar cycles (new moon to new moon) per year, which is also the reason most early cultures divided the year into 12 or 13 lunar months of 354 or 384 days.
A more entertaining possibility suggests 12 stemmed from the number of joints on the four (non-thumb) fingers of one hand.
https://www.thenews-messenger.com/story/news/local/2022/09/21/timing-is-everything-why-24-hours-to-day-and-60-minutes-to-hour/69503622007/
12 is also a pleasing number in how many ways it can be evenly divided into equal groups.