Casting resins have very different characteristics, like:
- virtually no shrinkage
- no flowing once cured
- hardness
- stable color
- crystal clarity
- some don't put out much heat during cure, so they can be used in thin thermoplastic molds
- etc.
There is a long list of differences, and hot glue basically sucks at those characteristics. If you need the characteristics of resin, Elmy's right, hot glue probably wouldn't be a great choice. That said, "it's a big world out there"; not all casting requires those characteristics. Also, if you are aware of hot glue's shortcomings you can often compensate for them.
So back to the original question, depending on the mold material and size, what you need it for, and your expectations, casting with hot glue from a pan could potentially be a good solution for you. Or it could be completely inadequate for your needs.