Gears switch automatically on smart trainer
First, this is not a between-brands compatibility issue. Microshift products are generally compatible with Shimano. In fact, in 11 speed and below groupsets, Shimano, SRAM, Microshift and others all use the same standards for cassette sprocket spacing and chain width, and there is a general cross-compatibility.
Freehub bodies for 11 speed road groupset cassettes are slightly longer than those for 10 speed or less. 8, 9 or 10 speed cassettes need to be installed with a spacer behind them. Check that you used a spacer when you installed the 9 speed cassette on the trainer.
Also, on different manufacturer and model hubs (both on wheels and trainers), there is some variation of the exact lateral position of the free-hub body that holds the cassette. That means that if you swap wheels or put a bike on a trainer the adjustment of the rear derailleur will usually need to be changed.
Run through a rear derailleur adjustment process with the bike in the trainer to properly set the upper and lower limits, and the sprocket indexing. Park Tool Repair Help has very good step-by step instructions..