Is the second law of thermodynamics a fundamental law, or does it emerge from other laws?
In thermodynamics, the early 19th century science about heat as a "macroscopic entity", the second law of thermodynamics was an axiom, a principle that couldn't be derived from anything deeper. Instead, physicists used it as a basic assumption to derive many other things about the thermal phenomena. The axiom was assumed to hold exactly.
In the late 19th century, people realized that thermal phenomena are due to the motion of atoms and the amount of chaos in that motion. Laws of thermodynamics could suddenly be derived from microscopic considerations. The second law of thermodynamics then holds "almost at all times", statistically – it doesn't hold strictly because the entropy may temporarily drop by a small amount. It's unlikely for entropy to drop by too much; the process' likelihood goes like $\exp(\Delta S/k_B)$, $\Delta S \lt 0$. So for macroscopic decreases of the entropy, you may prove that they're "virtually impossible".
The mathematical proof of the second law of thermodynamics within the axiomatic system of statistical physics is known as the Boltzmann's H-theorem or its variations of various kinds.
Yes, if you will simulate (let us assume you are talking about classical, deterministic physics) many atoms and their positions, you will see that they're evolving into the increasingly disordered states so that the entropy is increasing at almost all times (unless you extremely finely adjust the initial state – unless you maliciously calculate the very special initial state for which the entropy will happen to decrease, but these states are extremely rare and they don't differ from the majority in any other way than just by the fact that they happen to evolve into lower-entropy states).
It has not be proven that The Second Law of Thermodynamics is physically derived from other basic physical principles. The H-Theorem is predicated upon some pretty serious, yet plausible, assumptions about how our universe works. To my knowledge, these assumptions have not themselves been explained using other principles and/or experimental verifications of some kind; for the kinetic equation, upon whom the theorem derives life, contains fundamental assumptions about how particles interact. That said, the H-theorem is a beautiful model of the interaction of particles, and we see a strong resemblance of it's behavior to the physically observable concept called Entropy.
My question is basically this. Is the second law of thermodynamics a fundamental, basic law of physics, or does it emerge from more fundamental laws?
It would be useful first to say what is the 2nd law and what it isn't.
2nd law: when system goes from equilibrium state 1 to equilibrium state 2 in any way and exchanges heat with reservoir at temperature $T_r$, $$ S_2 \geq S_1 + \int_1^2\frac{d Q}{T_r} $$ In special case there is no heat transferred, $$ S_2 \geq S_1. $$
This law is valid for controlled macroscopic systems such as the working medium in a heat engine. Within this domain, it is a basic law.
2nd law does not say that the entropy of all systems or Universe has to increase in time. It speaks only of states of thermodynamic equilibrium.
There were and are attempts to derive 2nd law from microscopic theory, but there are always some additional assumptions about the probability. With these, it was proven that the above law will be obeyed in an actual process with probability very close to 1 (the greater the number of particles, the better). Since probabilistic ideas are involved, it cannot be said that the law is derived as unescapable consequence from the equations of motion.
Let's say I was to write a massive computer simulation of our universe. I model every single sub-atomic particle with all their known behaviours, the fundamental forces of nature as well as (for the sake of this argument) Newtonian mechanics. Now I press the "run" button on my program - will the second law of thermodynamics become "apparent" in this simulation, or would I need to code in special rules for it to work?
Most probably it will not be apparent, since it would hardly be possible to ascertain whether the system is in some kind of equilibrium state.
If you somehow extend the notion of entropy to complicated particle/field system in any microscopic state, then the question makes much more sense, but then it is also no longer about the entropy of the 2nd law, only about the new concept of entropy.
Then, you will need to start the simulation with some initial conditions (boundary conditions). If all the basic equations in the computer model are time-reversible (and the most basic equations of motion are), then for each initial condition that leads to increasing entropy there is an initial condition that leads to decreasing entropy.
To find such "weird" condition, let's think of a model that describes particles moving under influence of their gravitational forces. Just consider the trajectory that increases entropy, take its final point, reverse all the velocities and start the simulation again. The system will retrace its past states, so its entropy has to decrease.
One can get systematic increase of entropy only if the initial states are being chosen in a special way. We do not know whether the Universe started in such special state or not, or whether the entropy of the Universe, be it anything, increases or not. These and related questions of "heat death of the Universe" are entirely out of scope of the 2nd law of thermodynamics.