"The man is in the restaurant."
Translation:Der Mann ist im Restaurant.
Good question! German likes to make a clear distinction between nouns as "subject" and nouns as "object". They do this with their articles and their adjectives. SO...'der' and 'das' because 'dem' when used for an "indirect object". And....'die' becomes 'der' for an indirect object. It's confusing at first, but ONCE YOU LEARN IT, there's no confusion because you'll know it is a feminine noun that's an object in the sentence.
I suggest reading http://yourdailygerman.wordpress.com/learn-german-online-course/ This guy's a linguist, and he discusses all the weird stuff in german. He makes sense of "cases", which is what you'd want to read to more clearly understand 'dem'. There are other websites with tables and crap you can memorize, but I find that really boring!