The X part meaning unknown has been covered fairly well here; factor, not so much. The word has two common meanings. The first is multiplicand, a component of a multiplication or product. From JHCL's Tolstoy quote, we an determine the strength S of an army of mass M via the equation
S = M*x
as soon as we can figure out what x is. I don't think this helps much with the query.
But factor also has a medical use, meaning some chemical -- a mineral, a hormone, a vitamin, etc. -- required for the operation of some physiological process. These appear, among other places, in the context of growth (of the body or some part thereof) and in blood coagulation.
Back in the day (i.e., the 1920s) doctors thought they had isolated a bacillus that caused influenza. They named it Haemophilus influenzae, the blood-loving influenza-causing bug. (They had indeed identified a pathogen, but not the one causing influenza, which is virus and was beyond the technology of the times to isolate.) Researchers determined that Haemophilus influenzae loved blood because it required two components of blood to survive. One, thought to be a vitamin or a vitamin analogue, they called V-factor. The other was a complete unknown, and that one they called X-factor.
The 1918 influenza pandemic hadn't yet been erased from the country's collective memory, and the return of the disease in the 1928 epidemic must have increased public awareness of it and the attempts to eradicate it. In its January 21, 1930 edition, The New York Times ruminated on the 3000-fold increase in US small pox cases over the previous year while noting the 40-fold decrease in that disease in Italy during the five years after the armistice:
It is the same X factor which so regularly arises to sober man's
pride in his conquests, to remind him that his bulletins of victory
one section of the front are to be read in light of less cheerful
information elsewhere.
Did X factor escape from a medical lab into common usage, meaning an unknown and mysterious but crucial element in the explanation of some phenomenon? The Times has no other references, and the V-factor shows up too late in that paper (on April 16, 1939).