Why is a one element set not equal to the element? In treatments of set theory, it is assumed that a one element set is something different from the set itself. However, this doesn't seem obvious to me. For instance, an army containing only one soldier is the same thing as the soldier. Why can't this analogy be applied to sets?
 A: You are asking why $\,x=\{x\}\,$ is false in set theory. The usual answer is that
$\,x\in\{x\}\,$ by
definition of singleton sets and thus, if
$\,x=\{x\}\,$ were true, then this would imply that
$\,x\in x\,$ which is usually forbidden by the axiom
of regularity in Zermelo-Fraenkel set theory. However, the Wikipedia article also states

Virtually all results in the branches of mathematics based on set theory hold even in the absence of regularity

and thus it is a matter of convention and of
convenience. The article further states

In addition to omitting the axiom of regularity, non-standard set theories have indeed postulated the existence of sets that are elements of themselves.

and thus it is depends on  which particular
version of set theory you are using. Consult
the Wikipedia article
Non-well-founded set theory for some of these details.
This is further complicated by the existence of urelements.
The axiom of regularity article further states

Urelements are objects that are not sets, but which can be elements of sets. In ZF set theory, there are no urelements, but in some other set theories such as ZFA, there are.

and again, it depends on which particular version
of set theory you are using. The key idea is that
set theory is a theory with many different variations and it sometimes matters which one you
decide to use.
Your question about

Why can't this analogy be applied to sets?

is that it could -- provided that you use some particular consistent version of set theory which agrees with your intuition.
A: Suppose that $S$ is the set $\{1, 2, 3\}$. Is there a set which has $S$ as an element, but contains no other elements?
Maybe there is, maybe there isn't. Let's consider both possibilities.
If the answer is yes
In this case, yes, there is a set which has $S$ as an element, but has no other elements. Let's call that set $\{S\}$.
Is it possible that $\{S\} = S$? Well, we know that $\{S\}$ has only one element (namely, $S$). On the other hand, $S$ has multiple elements. So $\{S\}$ cannot possibly be the same thing as $S$.
If the answer is no
In this case, no, there is no set which contains $S$ as an element but has no other elements.
If you want to define sets this way, then you have every right to do that! But now working with sets is going to become very frustrating.
Why would it be frustrating? Well, suppose you want to say, "Let $T$ be the set of all sets which have such-and-such property." What happens if if $S$ has that property and no other set has that property? Bad things happen! Let me explain.
Since $T$ is the set of all sets which have such-and-such property, and $S$ is the only set with that property, we can conclude that the set $T$ has the set $S$ as an element, but $T$ has no other elements. But wait a minute—we just said, a few paragraphs ago, that that's impossible! So, apparently, our definition of $T$ is invalid. That's awfully confusing.
We mathematicians don't want to have to face those kinds of frustrations, so when we define sets, we choose to define them in such a way that $\{x\}$ does not have to equal $x$. Indeed, most mathematicians choose to define sets in such a way that $\{x\}$ is never equal to $x$. That seems to make things easiest.
A: I think you're getting tripped up because you're trying to use concepts from “set theory” 1 directly on real world things. Mathematics does not operate in the real world — it operates in the world of axioms and statements and proofs.
Digression into Formal Logic
A theory is nothing more or less than:

*

*a selection of symbols: operators, function symbols, variables, etc., and

*axioms: statements made using those operators, function symbols, and variables, combined with symbols defined by the logic being used, often First-Order Logic, a.k.a Predicate Logic (as is the case for set theory).

These are all purely theoretical and symbolic objects. They have no meaning (at least no inherent meaning). So, for set theory, we have the operator $\in$, the constant symbol $\emptyset$, and an infinite set2 of variables.3
The axioms are statements, like the axiom of extensionality in set theory:
$$\forall x \forall y [ \forall z ( z \in x \iff z \in y) \implies x = y].$$
The symbols $\forall$, $\iff$, $\implies$, and $=$, are all defined by First-Order Logic. We can construct other statements, purely symbolically, from the grammar of the operators, function symbols, and variables. These statements also have no inherent meaning.
From a statement, we can attempt to prove or disprove the statement, by constructing various proofs using the logic system combined with the axioms. The proof itself is (again) purely symbolic. If we can prove the statement, we say it is “true”, and if we can disprove it we say it is “false.”
I mention repeatedly that these objects are all purely symbolic because it's important to understand that the theory by itself is useless, at least for the purpose of describing sets. There isn't even anything called a set in the universe of set theory — only operators and statements and axioms and truth values. It's only called “set theory” because we have in mind a particular use for it.
Back to Reality
So if theories are purely symbolic and meaningless, what good is set theory, or indeed formal mathematics? The answer is that we pick other systems, called models, and map the theory onto the model. We provide a mapping from symbolic objects to objects in the model, and show that the axioms are “true” 4 for the model. We say that the model is an interpretation of the theory, and then we know for any formal statement in our theory, there's a corresponding statement about the model with the same truth value. (I'm hand-waving here.)
So why is $x \neq \{x\}$?
Because, at the end of the day, if we want to apply the theory of set theory to our model of sets, we need to choose a model of sets that interprets the theory of set theory — and in set theory, the statement $\exists x \exists y (x = y \land x \in y)$ can be disproven, thus is false, and thus the corresponding statement must be false in our model. So we know your model, where an army of a single soldier is equal to the soldier themselves is not a model of set theory.
So why did the creators of set theory choose for their theory to work this way? As I've said, the theory has no inherent meaning, so its creators had a countably infinite universe of theories to choose from — so this was a real choice. I think probably because they found their theory to be a good compromise of:

*

*intuitive: having models that most mathematicians can understand,

*useful: having the sorts of models that mathematicians would need in their work,

*powerful: having axioms that can capture the truth value of many different sorts of statements, and

*tractable: having axioms that actually allow most useful statements to be proven.5
As others have said, it's possible to define other theories that capture the property you've mentioned, but presumably they have trade-offs in these areas. We've chosen to build a lot of our mathematics on top of the modern formulation of set theory, so it's been Good Enough™.

1 I put the phrase in scare quotes because there have been multiple formulations of theories of sets over the ages. The most popular today is Zermelo–Fraenkel set theory, and it's the one most people mean when they say “set theory.”
2 This is of course slightly begging the question, because we're defining a theory of sets using sets, but there's a distinction. The set of variables is not part of the universe of sets being described by the theory. It's purely part of the formalization of the theory.
3 Note that the brace operator $\{\cdot\}$, a.k.a. set-builder notation, is not part of this theory. It's defined purely in terms of $\in$ and $=$.
4 More scare quotes because, as you may see, this is a recursive definition. We'd need to use some formal logic system to prove this correspondence. There's a reason Whitehead and Russel's Principia Mathematica only completes the proof that $1 + 1 = 2$ in the second volume.
5 Gödel's Incompleteness Theorem shows that any “suitably powerful” theory in first-order logic is either incomplete (has statements that cannot be proven or disproven) or inconsistent (has statements that can both be proven and disproven). So the goal of a theory is to make many useful statements provable and avoid being inconsistent. This is part of the “craft” of formal logic.
A: A bag containing an apple isn't the same thing as an apple.
A: Mathematics doesn't work on analogies. It works on pure formal definitions. Two sets $A,B$ are equal if and only if every element of $A$ is an element of $B$, and every element of $B$ is an element of $A.$ The sets $A = \emptyset$ and $B = \{\emptyset\}$ are not equal, since $\emptyset\in B$ but $\emptyset\not\in A.$ Sets are purely formal rigorous objects. You cannot make random analogies to reason with them.
A: Suppose $A$ is the set $\{1, 2, 3\}$, and $B$ is the set $\{A\}$. Then $B$ contains only one element, namely $A$, but $A$ contains three elements. So they can’t possibly be the same thing — they contain different numbers of elements!
