Starting with Germany. Germany wanted to attack into the Southern areas of the Soviet Union for two reasons. First off they had lost a lot of momentum after they failed to capture Moscow in 1941, and since Moscow was still too strong to attack they choose to attack the Southern regions of the Soviet Union. But more importantly the Southern regions contained large oil reserves and other important materials that the Germans wanted to keep their war effort going.
Eventually they settled on Case Blue, which was a simultaneous drive into the Caucasus and an towards Stalingrad. Stalingrad was considered key to Case Blue's success because otherwise the flank of the armies driving into the Caucasus would be exposed. So Germany settled on a plan where Army Group B would drive towards the Don and take Stalingrad and Army Group A would drive into the Caucasus. The Germans initially viewed Stalingrad as a way station into the Caucasus, but eventually both sides attached great importance to it. This would later be viewed as one of Hitler's mistakes, as Generals like Erich Von Manstein claimed he attached too much importance to taking Stalingrad at the expense of the attack into the Caucasus.
Stalingrad was important to the Soviets because it was a great transportation hub, it helped them command the area around Stalingrad, and it was a major industrial center, especially with regards to tank production. It also held a symbolic meaning to the Soviets, as the city is named after Stalin and thus if it fell would majorly damage the morale of the Soviets. That is why the Soviets put so much effort into defending it.
Sources:
When Titans Clashed by David Glantz
Stalingrad by Stephen Walsh