Original: The term originates from the custom of the commanding officer (usually, but not always, a flag officer) to fly a distinguishing flag.
Simplified: The term comes from the custom of the commanding officer to fly a special flag to show he was present.