My understanding is that GigaDevice Semiconductor make Flash chips, and decided to get into MCUs. They decided the best way to do that is create register-compatible versions of a market leader, who are very popular brand in China, namely STM, (I guess because they are also low cost). GigaDevice are a legitimate ARM licensee, so it is possible they got a few silicon engineers in a clean room and told them "create a compatible chip". It's also possible they have reverse engineered from a sample of STM chip, which may or may not be legal.
Whatever method they did choose, I am sure they found creating a top quality design is not that easy. This seems to be evident in the silicon problems with GD32 devices.
STM chips are already pretty good value in the Cortex M market, so saving a few cents on a rather poor copy just doesn't seem to make any sense. Add to that the problems of getting support, and that GD software seems to be a blatant copy of STM software, there isn't a whole lot going for it. I guess if I was a Chinese manufacturer wanting to save every cent, didn't care much about quality, then I might consider GD32.
The background to this is that the Chinese government are investing $ billions into their semiconductor industry, to try and reduce the amount they pay to foreign companies for semiconductor devices. The Chinese realise that state-run companies are not the answer, so they funnel grants and investment funds into investment trusts, who then fund private startups as well as established companies. Eventually they might have enough domestic skills to create their own IP, but so far they are in the "copy and clone" phase.