My understanding (from childhood memory) is that Boeing submitted its design for a military transport and lost to Lockheed, which won the contract. The Lockheed 'plane was the C5A Galaxy.
Boeing then had a design but no customer. Until, that is, it was converted to civilian use, became the 747 and Pan Am signed the first order.
Perhaps I'm wrong e.g., maybe the initial design was for either civilian or military use.
The rest, as they say, is history.