You're telling a story about a silly mistake you made. You thought you couldn't get into your house, so you spent the night in a cheap hotel. Now you're telling the punchline of the story. You say:
It turns out that my roommate had left his window unlocked anyway.
You use "it turns out that ___" when you got some information wrong, and you're telling what the correct information actually is. You first have to say what you thought was true (or the listener might already know this from other conversations you've had). Then you say something like:
It turns out that it's on Wednesday, not tomorrow.
So it turns out that I had been waiting on the wrong side of the train station.
In the U.S., people call the people that they share a house or apartment with "my roommate". This sounds strange to British and other English speakers because you don't actually share a room with your roommates. But that's the meaning that "roommate" has in American English.
You use "had (done)" when you're telling a story, and you want to talk about something that happened before what you're decribing. In the example above, "my roommate had left his window open" happened before the speaker spent the night in a hotel.
Here's another example from another post:
I was really sleepy because I had gone out drinking the night before.
When you "leave __ open", it means that you don't close it.
(Print this lesson)