In order to exist in this universe, things must be logical. Logic is mathematics, so this is a way to say that, to exist in this universe, things must abide by the rules of mathematics. And, as mathematics is the discovery of how the world works, the last sentence is a [tooltip tip=”In logic, a tautology is a formula or assertion that is true in every possible interpretation. ‘It is what it is’ is a good example.”]tautology[/tooltip].
Physics is applied math. If the universe is applied logic, one could argue that physical laws are the foundation of the universe.
But we can’t be sure of the reality of the outside world, because all we have is our perception of how the world works. So maybe nothing lies on the foundation of everything.
This is too broad a stroke. Be it math, physics or philosophy, what are the two or three fundamental laws of nature? Let’s round up our usual suspects.

Most fundamental law of nature by Very Complicated Stuff
On the side of math, our two pretenders are set theory and topos theory.
Fighting for physics we find quantum mechanics and GUT.
And on the side of philosophy we have solipsism.
Let’s proceed backwards. Solipsism. This is the theory that says that only my mind is real and all of you are but figments of my imagination. It’s true we can’t be sure of anything. It’s possible there’s no reality outside of ourselves. It’s possible that everything is just an illusion. But it looks like a consistent illusion, an illusion with rules. So the only way to forward our knowledge is to act as if the illusion were real. Besides, with my luck I’m sure that, if solipsism is true, the only mind in the universe will belong to another one.
GUT. The theory Einstein chased his entire life. The theory most theoretical physicists are chasing nowadays. The theory of everything or, if you prefer, a theory to rule them all. Isn’t it compelling? Of course it is. There’s only one problem: it doesn’t exist… yet. There are four fundamental forces in nature: three of them are well explained by quantum mechanics and the other one, gravity, is well explained by relativity. But relativity and quantum mechanics do not get along well, they don’t speak the same language; in fact, they’re irreconcilable. Of course there are several candidates, but they haven’t been proved, or disproved. Physicists have spent almost a century trying to settle their dispute to no avail.
Quantum mechanics. Finally something tangible. This is probably the most powerful theory humankind has ever had. We owe to it some handy things like nuclear reactors or mobile phones. And it’s stranger than anything concocted by the craziest, most imaginative of sci-fi writers. It could very well be the most fundamental law of the universe. The only problem is: what do we do with gravity? It looks like God created a perfect universe ruled by quantum mechanics and then looked at it and saw that there were no planets and no life, so he added gravity to make it a less boring place. But he added it in the last moment and in a sloppy fashion.
And here’s another thought: before creating reality you must create the rules that will conform that reality. This is the same as saying math must precede physics, as all high-school students know.
There are a few mathematical theories that claim to be the foundations of all mathematics. The most important are set theory and topos theory.
Set theory is that thing with Venn diagrams and unions and intersections. It seems a little silly, but the rest of mathematics can be derived from it. It makes sense: if in the beginning there was unity and diversity was the first thing created, then the study of diversity should be the foundation of everything.
If you want a basic example of how to derive the rest of math from set theory, here you have an explanation of multiplication as a special case of operations with sets.
What about topos theory? It belongs with a very abstract part of math called category theory. You know, mathematicians are obsessed with abstraction, so obsessed that sometimes it seems they have forbidden all talk of real things in their classrooms. I’ve heard a mathematician stating that math needed just five numbers and three of them were letters: 1, 0, e, i and #. “The rest of numbers,” he added with a thinly veiled contempt, “is for physicists.”
Sets are a category and topoi are another category. They are similar to sets, but with a sense of topology, that is, of space.
Out of these five suspects, my preferred theory to be the foundation of everything is set theory. But, please, don’t take my word for it and chime in with your own ideas.