The company name is approved within the scope of provinces and cities. Within this scope, the same name cannot be duplicated in the same industry. What you said is not a duplicate name.
In addition, well-known enterprises and trademark names are protected and may not be used.
So an unknown company, or when it is unknown, can be registered in different regions or different industries.
the classification of trademarks is more detailed, and different product categories can be registered in the same industry. For example, if someone registers "AB" cement, you can register "AB" bricks.
trademarks are specific to specific products, and the company name has nothing to do with the products.
Of course, if that company is called XX Liquor (Guangxi) Co., Ltd., then you can't call it Guangxi XX Green Food Co., Ltd., because XX Liquor (Guangxi) Co., Ltd. is a national company registered in the State Administration for Industry and Commerce.