Read up on the Factory design pattern in general. The answer linked in Leo's comment (https://stackoverflow.com/a/1310415/2762475) links and explains some documentation. That's a good place to start. Dependency injection in general can be extremely useful, but perhaps is outside your use case for EntityManager.
IMO, the key thing to understand here is the purpose of the factory: as a consumer of the product (in this case, the Manager), all you have to do is order one from the factory and they will give you the right one. Compare this with a big pile of products that you can grab from willy-nilly. This is fine if you're the only one grabbing, but as soon as competition for resources arises, you can't ensure you get the exact object that you need, even if you know what it looks like.