I thought masya'allah meant something along the line of 'all praise goes to god.' I was taught to use when you praise someone or something, or when you're bragging lol. It's important to use it to protect oneself from jealousy.
Insya'allah means 'if god wills it' so you use it when you make plans or when you want something to happen in the future. For example, "I'm going to work hard and get a full score on the test, insya'allah."