It is said that during the Ming dynasty, the dominant language spoken was similar to Cantonese. Reconstructions of Middle Chinese from before that time sound much more like Cantonese than mandarin. Mandarin looks and sounds nothing like the Manchu language, but Qing officials were called mandarin.
This could warrant a pretty long answer, depending on how deep into the history you want to go. With that in mind I'm going to give you a somewhat superficial answer, and then if you have questions about specific areas of that answer, please ask follow up question in reply and I'll be happy to expand.
It is said that during the Ming dynasty, the dominant language spoken was similar to Cantonese.
This isn't accurate. Or rather, it's selectively active. There are certain features of Cantonese that are more conservative of the way Chinese languages sounded in the past. Also, the Ming isn't really the best reference point since Mandarin and Cantonese and Wu and the like had mostly split up by then. The Tang is a more useful reference point and a more common one to be cited.
Middle Chinese, the name given to the collected forms spoken during the Tang (~600CE), had consonants -p -t and -k at the end of syllables. Cantonese still has this, as do Hakka and Min. But Mandarin has lost them. Mandarin also lost tonal distinctions which existed in Middle Chinese and are preserved in some other Chinese languages. Mandarin also largely lost [b] and [d] and [g] at the beginning of syllables, and so did Cantonese, but these are retained in Wú (Shanghainese). So in that regard, Cantonese is actually just like Mandarin in regards to the parent language, while Wú ends up being more conservative. Still, globally, you can't say one modern language is more like Middle Chinese than all the rest, since different ones are conservative in different areas.
By the Ming, these had already split up, so that Cantonese was already a thing, as was Wú, as was Min (which was actually a much earlier split). The Tang is really the period that we should be comparing things to if we expect it to be a more overall applicable comparison. Mandarin during the Ming kinda just sounded like Mandarin does today in Jiangsu Province, for the most part.
Reconstructions of Middle Chinese from before that time sound much more like Cantonese than mandarin.
This is because you're only focusing on the final consonants, or the greater number of tones in Cantonese than Mandarin. If anything, Northern Wú dialects are more representative of tone in Middle Chinese than Cantonese which has seen additional tone splitting. You're also only looking at this with Standard Mandarin in mind, not some of the dialects like Nantong which are much more representative of the older forms as regards syllable structure. "It sounds more like Cantonese" is subjective and usually with a very selective focus.
Mandarin looks and sounds nothing like the Manchu language, but Qing officials were called mandarin.
This has nothing to do with the linguistics. "Mandarin" is the English name, but not what we call Mandarin in Chinese. And the English word "Mandarin" is allegedly from 滿大人 man da ren, "Manchu Official". But this has nothing to do with the language and again it's not the name of the language in Chinese anyway. So you really should just ignore it completely because it's only going to confuse the issue.
There are two questions you can be asking. One is where the language came from, which I started to answer but will be happy to expand. The other is where the name came from, which is the previous paragraph. Unfortunately, the two questions aren't really related. The first is based on a misunderstanding of the actual linguistic development and differences, and the other is really just about English terms for foreign things, which doesn't actually tell us much about what's going on behind the scenes.