"M'enfin" is the short for "Mais enfin" in French.

Litteral translation: "mais" means "but" and "enfin" usually means "finally" (reality is that this word can be used in so many situations, it exceeds the purpose of this writeup) .

You can say this when you're annoyed by something happening suddenly or by someone telling you something a little offensive.

In other words, it is a mild translation of "What the fuck?"

Although this is popular language, you can say "M'enfin" in a social event, well, maybe not in front of the Queen.

The most famous M'enfin utterer is the great Gaston Lagaffe.