From 1790–1835 the Patent Act of 1790 dictated 14 years from issuing and from 1836–1860 patents ran 21 years from issuance under the Patent Act of 1836.
Before being swapped to 20 years from filing, patents between 1861 and 1994 ran 17 years from the granting date under the rules of Pub.L. 36–88 (12 Stat. 246). The time a filing spent in the USPTO before granting was - on average - 3 years, thus in practice about 20 years. However, that was somewhat unreliable: some patents came faster, others took longer, leading to at times more or less protection on different patented parts.
With the reasoning to give a more streamlined process, they swapped to 20 years from filing in 1995 under the Uruguay Round Agreements Act. The act was the result of the Makaresh Agreement and other agreements that create the WTO and resulted in not only the Berne convention but also similar patent runtimes globally.
Under some conditions, one can extend a patent, and delays in the patent office (answer deadlines missed or evaluation taking longer than 3 years) or other approval processes (like FDA approval in pharmaceuticals or waiting for security releases) can be reasons for an extension of a patent.
In some cases though, a patent might be shortened too: if your patent stems so directly from another that it becomes obvious the moment the other patent becomes prior art, then both expire simultaneously.