Why in Mandarin chinese, USA is beautiful kingdom and England is hero kingdom?
They are not really called beautiful kingdom and hero kingdom. When Chinese come up with phonetic names of foreign things, they try to find a character that come close enough in sound while having a good meaning. Luckily 英 and 美 happen to correspond well with "Eng-" and "-me-" while having suitable meaning.
Just like France 法兰西 (法国) has meaning of 法 Law.
And Germany 德逸 (德国) has meaning of 德 Moral.
亚美利加 (America), used 美 because 亚 is reserved for Asia.
Japanese uses 亚米利加 (米国 rice country lol)
英吉利 (England), UK is 大不列颠 及 北爱尔兰 联合王国 (Great Britain and Northern Ireland United Kingdom)
You can also refer to the UK as 联合王国.
Actually they all came from their pronunciation.
America: 美利坚 ("美国" for short)
England: 英格兰 ("英国" for short)
Remember that despite having a writing system much more heavily vested in meaning vs pronunciation, Chinese still has a need to transcribe foreign sounds and words. Speakers of European languages tend not to notice this issue as much, because words from other languages can at least be approximated by sound, if not assimilated completely.
Chinese does not have such an easy option, and the result is that transcriptions cannot escape having meanings - often quite interesting ones in this case. The general rule with country names seems to be a selection of something that sounds similar to the name of that country in its own language, and that is complimentary in some way, or at least not derogatory. Some countries come out of this better than others, e.g. 美国 and 英国 vs 西班牙 and 俄罗斯.
There is a set of characters that tend to crop up a lot in these transcriptions, too many to list here, but common examples are 奥, 利, 德, 阿, 斯.
Interestingly, you also encounter issues where a foreign transcription word entered the Chinese lexicon through a Chinese language other than Mandarin, or even a non-Chinese language that makes use of hanzi, such as Japanese. When this happens they don't seem to sound like the original word at all. An example is the UK city of Cambridge, which is 剑桥 in Chinese. This sounds nothing like Cambridge in its Mandarin pronunciation (Jiànqiáo), but that's because it entered through Cantonese, in which it's pronounced Gim3kiu4. So you've got "gim + bridge", which makes much more sense.
TL;DR - these are transcriptions focusing on sound. The meaning is a secondary concern.
In fact, there is no meaning of beautiful (美) for America, it is just a name. Think about the name:
Mr White, not means that the name is only for white people.
We just show our kindness, that we like this country with positive words.
When someone doesn't like America, he/she will call America "霉国", the pronounce of "美(mei3)" and "霉(mei2)" are similar. But "霉" are totally different meaning, it means "Rotten"