In the 17th century, Archbishop James Ussher wrote, "In Annales veteris testamenti, a prima mundi origine deducti"
(Annals of the Old Testament, deduced from the first origins of the world.) In this book, he worked out that the first day of creation began at nightfall preceding Sunday, Oct 23, 4004 BC - by using biblical genealogy.
Ussher's specific choice of starting year may have been influenced by the then-widely-held belief that the Earth's potential duration was 6,000 years (4,000 before the birth of Christ and 2,000 after), corresponding to the six days of Creation, on the grounds that "one day is with the Lord as a thousand years, and a thousand years as one day" (2 Peter 3:
Ussher was a Protestant. In the UK, Henry VIII had broken from the Church of Rome and rejected papal authority. This meant that there was no longer any way of resolving interpretation issues in the Bible (other than guidance from Luther who, himself, was not granted any infallibility.)
A consequence of this was that each man became his own priest. The Age of Science was dawning but the Scientific Method was in its infancy. Ussher did take great pains with his calculations and researched ancient documents. He himself was rabidly anti-Catholic and for this he received royal patronage and his ideas broadcast as "The final Proof of God." Ussher felt that the Church of England needed to steal a march on the papists; this was one way of doing it.
The results were widely praised and nobody could find fault with his meticulous research. It therefore became not so much established doctrine, but a "well it's been proven" concept.
The Puritans, who accepted such things, then went off to the Americas and took the idea with them. In response to later, mainly European, ideas and discoveries, their descendants, anxious not to offend God and anxious not to suffer cognitive dissonance, created an increasing number of excuses as to why the Earth was young and everyone else was mistaken.
Ussher's ideas, whilst not rejected, are rarely brought out, perhaps because the Biblical genealogies are patently unreliable. Instead, the YECs currently rely a lot on various anomalies in radio active decay and cumulative evidence of various floods in isolated areas.
They seem to have reached a point at which the war is over but they are still fighting, in the hopes that something will turn up which will add new piece of evidence, so they may start the war again.