失礼します / shitsurei-shimasu literary means “do something rude” but this phrase actually has different meanings.
First, we use this phrase when we enter a room like teacher’s room, boss’s room etc. The usage is similar to “May I come in?”. The slight difference is that “May I come in?” is used before entering but “失礼します” is used when entering. 失礼します is actually used as an polite expression of “I’m coming”.
失礼します is also used as an introduction of doing something unusual or used in a situation where you have to do something that you actually don’t feel like doing. For example when you have a meeting and got a phone call you may have to leave the meeting for a while. In that situation we’ll say “会議中失礼します。電話がかかってきてしまったので少し席をはずします。 (Excuse me to interrupt the meeting but I got a phone call so I’ll leave for a while)”. You can also say just “少し失礼します (I’ll leave for a second)”.
Other examples are below;
“Excuse me for calling this late, but since this is an urgent matter so I’m calling.”
“I should meet and talk to you but excuse me for explaining this on the phone.”
On the other hand, 失礼しました is past tense. So this is used when leaving a room. Interesting thing is 失礼します is also used when leaving a place as I explained in this article : “What would you say when you leave office in Japanese?”. In this case both of them mean the same thing.
Also, 失礼しました means “excuse me”. 失礼しました literary means “I did a rude thing” but this sentence has a hidden meaning : “and I’m sorry”or “and please excuse me”. This is why 失礼しました is used as an apology.