Is it trespassing if my ex tries to come into the house after we’ve separated?

Yes. If you are legally separated, your ex cannot demand entry to your home or the marital home. If this “domestic trespass” is a strong probability, it would be advisable to change your locks. You should be aware, however, that your ex will most likely be allowed by the court to return to gather clothes and other personal items at a per-arranged time.