Generally, a landlord can only enter your apartment to inspect the unit, to make repairs, or to show the apartment to a prospective purchaser, tenant, or moartgagee. Usually there needs to be notice given before access is granted to the landlord. If the landlord enters without the right to do so, you may be entitled to damages or seek charges for trespassing.
Disclaimer: This answer is provided for informational purposes only and it is not intended as legal advice. Additionally, this answer does not create an attorney-client relationship. If you wish to obtain legal advice specific to your case, please consult with a local attorney.
In Massachusetts, if your lease term is coming to an end, your landlord has a right to enter your unit to show it to a potential new tenant. Your landlord can also enter your unit in the last thirty days of your tenancy to assess damages to the unit before you move out. In case damage is discovered, the cost to repair would be deducted from your security deposit. However, your landlord should give you 24 hours notice before entering in each instance.
It’s probably a good idea to talk to the landlord and schedule a time to enter that accommodates both of you.