I know tera shift changes is to terastal form but how does it change to stellar
Terapagos changes form by Terastallizing.
Terapagos, when sent into battle will immediately transform into Terastal form and have its ability change. If it has the Stellar Tera type and Terastalizes, it will again change forms into the Terapagos Stellar form.
Source