How can I stop this from happening?
This is expected behavior.
Microsoft (Outlook.com) uses location data (if available) as part of their security to validate authorization access; t's more than just your IP.
You can view all of your activity from Microsoft at the site:
Using a VPN with Outlook.com
A VPN (Virtual Private Network) takes your traffic (all or some, depending on the policy set at the VPN server) and sends it through their network. If you go to https://account.live.com/activity while connected to VPN, you will see that your IP address has changed (very significantly). You are no longer "located" at your home, but now wherever your work's network gateway is located.
As such, (Microsoft) Outlook.com will detect this change and based on their security policies temporarily lock your access since it "appears" you went from one location to the next with the same cached credentials.
Turn on Two Factor Authentication
If you use two factor authentication (Microsoft Authenticator App), you can mitigate this somewhat. Outlook.com will detect the change in location and ask you to authenticate (iPhone version shown):
Prior to locking your account, it should ask you to approve or reject the new sign in.
Your other option is to close Mail (or log out of Outlook.com), connect to the VPN and then reopen. You will need to do this for each time there is a network change so there is a bona fide log in as opposed to an authorization request based on stale cached credentials.