I lifted this info from www.navyjack.info
A Brief History of the U.S. Navy Jack
In the fall of 1775, as the first ships of the Continental Navy readied in the Delaware River, Commodore Esek Hopkins issued a set of fleet signals. Among these signals was an instruction directing his vessels to fly a striped Jack and Ensign at their proper places. The custom of the jack-type flag had originated with the Royal Navy in the 15th century or earlier; such was the likely source of Hopkins' inspiration. This first U.S. Navy Jack has traditionally been shown as consisting of 13 horizontal alternating red and white stripes with a superimposed rattlesnake and the motto "Don't Tread on Me." The rattlesnake had long been a symbol of resistance to British repressive acts in Colonial America; its display on the new jack of the fledging Continental Navy fit naturally with the fervor of the times.
According to Dr. Whitney Smith of the Flag Research Center, the traditional design of the First Navy Jack has never been accurately determined. Historians inferred the design from Hopkins' message and a color plate depicting a slightly different "Don't Tread Upon Me" flag used as a Navy Ensign in Admiral George Henry Preble's 1880 book, History of the Flag of the United States. Historians' widely copied Preble's rare color plate, thus providing the probable source of the traditional design of the First Navy Jack.
The first U.S. Navy use of the Union Jack (a flag replicating the canton i.e. white stars on a blue field of the U.S. Flag) probably occurred soon after the adoption of the First Stars and Stripes Law on June 14, 1777. The First Stars and Stripes Law stated that the Flag of the United States be 13 stripes alternating red and white and that the union be 13 white stars in a blue field representing a new constellation. Although the date of introduction of the Union Jack is not precisely known, a 1785 engraving of the frigate USS Philadelphia clearly depicts the Union Jack flying from her jackstaff.
As the number of states increased, the Union Jack was altered to conform to the canton of the national flag. General orders were issued from time to time by the Navy Department when a change in the number of stars was necessary.
Navy Regulations, first promulgated in 1865, prescribed the use of the jack. It is displayed daily from the jackstaff of all U.S. naval vessels in commission, from 8 a.m. to sunset while the ship is at anchor. Additionally it is flown to indicate a court martial is in progress, and as the President's and Secretary of the Navy's personal flag.
There have been a few where instances where the traditional First Navy Jack has been used in lieu of the Union Jack:
In 1975, the Secretary of the Navy directed that the First Navy Jack be flown in 1975 and 1976 in lieu of the Union Jack during the United States Bicentennial Year as a colorful and historic reminder of the nation's and the Navy's origin.
In August 1977 (the date is sometimes mistakenly (?) given as 1980 or even 1981), the Secretary of the Navy specified that the ship with the longest total period of active service display the First Navy Jack until decommissioned or transferred to inactive service, at which time the flag shall be passed to the next ship in line with appropriate honors. Here are ships that have had this honor:
The USS Kitty Hawk (CV-63) received the distinction from the Independence November 20, 1998. The Kitty Hawk was commissioned April 29, 1961 and still proudly displays the flag.
The USS Independence (CV-62) received the distinction from the Mauna Kea on June 30, 1995. The Independence was commissioned January 10, 1959. It was decommissioned September 30, 1998, in Bremerton, Washington. Click here for more about the history of the USS Independence.
The USS Mauna Kea (AE-22). The Mauna Kea was commissioned commissioned March 30, 1957. It was decommissioned June 30, 1995.
The USS Prairie (AD-15). The Prairie was commissioned on August 5, 1940. It was decommissioned March 26, 1993.
The USS Dixie (AD-14) received the distinction in April 1981. The Dixie was commissioned on April 25, 1940. It was decommissioned in 1982. Click here for more about the Dixie flying the First Navy Jack.
On June 3, 1999, the Secretary of the Navy authorized submarines and submarine tenders to fly a special Submarine Centennial Jack throughout the year 2000 in honor of the U. S. Submarine Force's Centennial. This marks the first occasion since 1775 that a specific class of ships has been so honored.
On May 22, 2002, the U.S. Navy ordered all ships to display the First Navy Jack during the War on Terrorism.