Why did the Yongle Emperor move the capital to Beijing?
There are several different reasons why the capital was relocated:
Yongle was sent to garrison Beijing in 1380 and lived there for more than two decades. Beijing was his base of power from which he launched the military campaign that toppled his nephew. He felt more secure and comfortable in Beijing than Nanjing, and he and many of his close subordinates were not at ease with the humid climate of the south.
Like his father, Yongle attempted to control the steppes but he believed that offense was the best defense. Yongle would personally go on to lead five expeditions into the steppes and Beijing was more ideal as a military base to project power into the steppes than the faraway Nanjing.
Recent scholars have noted that Yongle attempted to bolster his legitimacy by emulating the great Yuan ruler Khubilai. Indeed, Yongle saw himself as the next Khubilai, much like Khubilai, Yongle became ruler through challenging someone with a better claim to the throne. Yongle would go on to patronize Tibetan Buddhism, which the Mongols were heavily attracted to. He rebuilt the temples on Mount Wutai, which had been constructed earlier during the Yuan by Khubilai to offer prayers specifically for the imperial family. He frequently took part in hunts (something that his father never did personally, though Hongwu recognized the importance of the hunt and admonished his sons to do it) and donned Mongol clothing that was popular with the Ming imperial family at the time. Relocating the capital to Beijing would have been another way to call upon the legacy of Khubilai.
Hongwu himself might have never been truly satisfied with Nanjing as a capital. He sent his eldest son, the Crown Prince Zhu Biao, in 1392 to survey Xi'an and Luoyang as potential capitals. But because Zhu Biao died shortly afterwards, if there was a plan to move capitals, it never went forward.
And how associated was Beijing with the Yuan dynasty?
Beijing then was still heavily influenced by the Mongols. According to Henry Tsai's Perpetual Happiness: The Ming Emperor Yongle, page 33:
Soon after the prince and his family settled into the revamped palace, he encountered both culturally and military-administrative problems that he had never before faced in his young career. For example, Mongol customs remained evident in Beiping [early Ming name for Beijing], and the Mongol language and script were kept alive and juxtaposed with Chinese in official documents. He was mindful that his father had outlawed several Mongol customs and fashions, and ordered the people to dress as they did before the Mongol invasions and not to use popular Mongol names. The prince found it difficult to enforce these orders at once, as he was convinced that it would take some time to embed changes in the new society.
You can tell from this map that a large portion of Ming Beijing overlapped with Yuan Dadu - although the entire city was shifted south. The Ming imperial palace was also pretty much in the same location as the Yuan palace, but it was also shifted south. Jingshan, or Coal Hill in English, is where the Yuan palace once stood. The Yuan palace was demolished and earth that was excavated for construction of the new city was dumped on top of it to create the mountain. But the three lakes (Beihai, Zhonghai, Nanhai), collectively known as Taiye Lake and which was constructed during the Yuan, was kept.
Debate on whether Beijing should be the primary capital raged well into the 1430s. It was only during the Zhengtong reign that the issue was finally settled and the Beijing was made the primary capital, with Nanjing downgraded to the status of auxiliary capital. For more than a decade, even though the emperor resided in Beijing and the government operated out of Beijing, Beijing was still designated officially as a secondary capital and the moniker xingzai 行在, best translated as auxiliary, was attached to all government agencies. This confusion was due to the fact that moving the capital north was considered a very controversial issue and was difficult to settle. Many officials and even the Hongxi emperor wanted to move the capital back to Nanjing.