The first example is fairly bad.
When you use 'A' to initialize the char you leave the 3 other bytes uninitialized... Generating this random 577...
If you start by initializing x at 0 you set the 4 bytes of the union to 0.
Then the value of x after setting a to 'A' will give you 65. The result makes complete sense 65 being the ASCII value of the char 'A'.