To avoid gas ejections due to the rotation of the asteroid in front of the star.
Quote from this source:
Asteroids typically don’t have tails, even those near the Sun. But recently, astronomers have seen some asteroids that have sprouted tails, such as asteroid P/2010 A2. This seems to happen when the asteroid has been hit or pummeled by other asteroids and dust or gas is ejected from their surfaces, creating a sporadic tail effect.
Mining asteroids in space could expose miners to a danger that would not occur in a confined space, such as inside a cargo ship. The outer layer of an asteroid may have "dried" for millions of years, but inside, chunks of solid rock may still have residues of ice or gaz that have been dormant from the formation of the asteroid. Exposing them to the sudden light of the nearest sun could ignite gas ejections, endangering mining ships and miners, and propel the asteroid in a dangerous rotating course.
Inside a ship, the amount of light/energy can be controlled and miners would be safe even if large chunks contain other things than just solid rock.