When talking about string theory they say how there is 12 dimensions and I am assuming they didn't pull that figure out of no where.
Actually they start with string theories that have 10 dimensions but there do exist theories with higher ones.
They do not pull these numbers out of their hat but they come from the constraints imposed in formulating the string theory.
To start with, why look at string theories which assume that elementary particles are not points but are excitations on a string?
It is because of the search for a theory that will unify all known interactions: electromagnetic, weak, strong and gravitational and will also allow for the quantization of gravity.
This unification , after the success of the electroweak unification model and the experimental observation that it is possible that even the strong interaction at very high energies unifies as SU(3)xSU(2)xU(1) the search was on for the Theory of Everything, TOE, which would include a quantized gravity.
At the moment the only candidate theory which can do that has to come from string theories, and string theories come with extra dimensions. It is only with extra dimensions that the standard model of particle physics can be embedded in the theory.
Since we do not observe any extra spacial dimensions they have to be suppressed by the dynamics of the theory in the models under consideration. It is not enough to embed the standard model and quantize gravity if there are predictions that will falsify the model, like observed extra dimensions. Thus the models proposed curl the dimension into sizes that would be unobservable, i.e. non interacting, at our level and detection capabilities.
So it is a long story, but a consistent one. One expects that from the thousands of possible string theories a model will emerge that can be checked against the data and validated at some point in the future.
So we do not "know" that there are more than three space dimensions. Theorists "suspect" that there are, and if/when a string theory model is validated by data, i.e. predicts new phenomena that are discovered experimentally, one would be justified to use the verb "know".