The first thing you have to remember is that gay men are as capable of having strictly platonic friendships as straight men are. And every man is attracted to different types and individuals. If a man asks you to his apartment it doesn’t necessarily mean he’s expecting sex, but it depends on the circumstances. If you’re in a bar and the guy is giving you signals that he’s attracted to you, then he’s probably inviting you home for a one-night-stand. This is true even if he says he’s asking you home for a "drink" or "coffee." Generally if the man is not interested in sex, he’ll make that clear somehow, saying something like "just to talk." (Although even in that situation a guy could always hit on you.) If you’re interested in talking but not in having sex, you can suggest that you go to a coffee shop instead of his apartment. If a man asks you what you like to do [in bed], he’s definitely after a sex hook up.
As for going out to dinner, that can be a romantic date or just two friends having dinner. Sometimes what begins as a platonic friendship can blossom into something more; the problem is when one individual wants to "upgrade" the relationship and the other one is happy just being friends.
In general, guys will give you signals that they’re"interested" in you in a more than platonic fashion. Some guys just come right out and say so. Others make passes or flirt (although flirting is not always a sign of sexual attraction or at least an interest in hooking up). Some guys are very good at hiding their feelings – they’re not sure of how you feel about them – and then spring it at you unexpectedly. But in most cases there will be clear signs that a man is interested in you romantically and/or sexually (and the two don’t always go together).
Admittedly, when it comes to gay men, our sexuality is a factor that straight guys don’t have to think about when it comes to male-male friendships. But it’s also true that most gay men have loving, close friendships with other men that are not "encumbered" with a romantic or sexual factor. Two guys who are just there for each other, which is the whole point of friendship.
And then there are "fuck buddies" – what straight people call "friends with benefits" – friends who on occasion have sex without romantic complications. But I’ll save a discussion of that for another post.