And even saying the 12 notes must have specific frequencies is wrong. It's very common when creating synths for example to detune them to create richer sounds, or play on dissonance to some extent.
There are lots of tuning systems. Equal temperament is just 12 (logarithmic) equal steps. But other tuning systems use different priorities.
The basis is physical, though. It's always about trying to get the frequency ratios as simple as possible (or as close as possible to a simple ratio). Based on the fact that natural overtones are always (more or less) integer multiples of the base frequency so that's what sounds pleasing to us. Using only integer ratios is impossible though, so we have to deviate from those. And on top of that we want to deviate because people get bored ;-)