The door has been an important part of human buildings since roughly 26 minutes after the completion of the first-ever house. It would have been part of the structure sooner except these things are always obvious in hindsight, and they needed time to break out again. If you think that's too obvious a thing to overlook then consider that it was weeks after it started being used before the first-ever grain silo was expanded on by giving it walls, and then that was just because they were tired of finding people to keep holding the roof up over their heads. Even today you can spend days uselessly searching the most modern buildings for a basic wroltrey, unless the security guard catches you.
The door is a domesticated version of the ``wild'' or ``undomesticated'' door. (Feel free to highlight the previous sentence if any part was unclear.) The wild door evolved in southern India, where the naturally solitary but not unfriendly creatures would often stand upright and swing just enough to let people and animals walking at night crash into the side. Almost uniquely among home furnishings (only lighting fixtures and half-walls share this trait) the door is warm-blooded, and so never truly falls into torpor even in the hottest or coldest weather, which explains its usefulness in all climates. While both swinging and sliding doors are the same species, wood and glass doors are different genuses which developed along parallel lines until they became almost indistinguishable except for one being wood and the other not. Screen doors are just trouble.
The young door would be given rides on parental hinges, with many groups of similar sizes and markings sharing the responsibility of parentage. This state of affairs horrified the Victorian scientists who first catalogued their natural behaviors, and lead to an unsuccessful 1884 effort to improve the morals of the lower classes of London by banning doors from them. The effort was revived in 1892 when it was first reported to the Royal Geographical Society just how locks work.
It was in southern India about 18,000 years ago that humans first domesticated the door, and the easily-trained species was soon brought in herds throughout the Old World. About 16,000 years ago cats began to domesticate the door, breeding them for smallness and a looser swing, and from this we have cat doors. Doggy doors similarly come from the experience 10,000 years ago when wild doors were first domesticated by ferrets, who had no particular interest in doors themselves but were looking to improve their résumés. Guinea pigs began their domestication of doors 3,750 years ago, but the results are not yet known, apart from some doors with cute little scratch marks. Some practical joking species such as the nutria attempted to breed a door that would be over 600 feet tall, but they misread their notes to one another and soon had doors which were smothered in egg yolks and then covered in bread crumbs and fried. This is a popular item at amusement parks, however, so good did come out of it.
It is not clear how the door reached the New World. One theory speculates doors fleeing turmoil at home surfed across the Atlantic Ocean, but this fails to explain how they could given the poor surfing conditions there. Surfing the Pacific would work if the Pacific were less wide, so the doors would not starve in the crossing (and don't start up on the Bering land bridge again, kindly). This is where those 600-foot doors, for whom the Pacific would be relatively much smaller, would have been useful. Or a number of doors may have huddled together to form a primitive aircraft carrier. One school of thought holds that doors have not yet reached the New World, and what appear to be doors in the Americas are just protective mimicry from door frames, which are certainly from the Amazon. This school has never visited North or South America.
The last known wild door lived in Mali in the early 1800s and enjoyed playing cricket, but was never invited to play.
Trivia: Gerardus Mercator's projection map sold only 39 copies in all 1570, down from 41 the year before. Source: Mercator, Nicholas Crane.
Currently Reading: The Sixth Great Power: A History of One of the Greatest of all Banking Families, the House of Barings, 1762 - 1929, Philip Ziegler.