I assume that you are executing Type.forName
in your managed package code. In this context many of the Salesforce APIs operate as if a namespace isn't defined, and this allows all your managed package code to reference stuff within itself (objects, fields, classes etc.) without need of the namespace prefix. This is the reason you see what you see.
Local objects with the same base name as packaged objects are always troublesome, and for me the rule of thumb is to avoid it. However, you can work around the discovery issue in various ways. One option is to use Schema.getGlobalDescribe and use a direct access using the full name as the key value into that map; as the documentation says:
The keys are prefixed with the namespace, if any.
Just make sure this code is using a recent API version (again the documentation helps you out here).
I would not normally suggest using Schema.getGlobalDescribe
because (at least historically) its performance sucks. Make sure you minimize the usages in your code. Take a look at this Q&A for more.
An alternative is to see if Type.forName('Schema', objectAPIName)
works for you, though I suspect it might not.
By the way, much of the code you posted is quite unnecessary and overcomplex; the Schema gives you tools for examining various facets of a given object type quite straight forwardly.
Type.forName('Schema', objectAPIName)
does not work butSchema.getGlobalDescribe
does.