A flagship is the ship used by the commanding officer of a group of naval ships. The term originates from the custom of the commanding officer (usually, but not always, a flag officer) to fly a distinguishing flag.
Used in this way, "flagship" is fundamentally a temporary designation; the flagship is wherever the admiral is flying his flag. However, admirals have always needed additional facilities; a meeting room large enough to hold all the captains of the fleet, and a place for the admiral's staff to make plans and draw up orders.
In the age of sailing ships, the flagship was typically a first-rate; the aft of one of the three decks would become the admiral's quarters and staff offices. This can be seen today on HMS Victory, the flagship of Admiral Nelson at the Battle of Trafalgar, now at Portsmouth, England.
In the 20th century, ships became large enough that most types could accommodate commander and staff, and during World War II admirals would often prefer a faster ship over the largest one. Increasing communications and computing requirements have resulted in the design of specialized command and control ships to serve as flagship.
A private ship is a warship which has no flag officer on board, and thus is not a flag ship.