I think it's a funny joke.
And in no way is it indicated it's a transgendered person. Could easily be a crossdresser. And it fits the setting since... Crossdressers have been around for hundreds of years.
And good humour is offensive. There's a reason Carlin, CK and Gervais are masters of comedy.
Transgendered people have also been around for hundreds of years. The surgeries we have today might not always have been available, and people would obviously have been more confused without things like the internet to allow them to realize that other people were going through the same situation as them, but there have surely always been people who did not identify as the gender they were born as.
As far as humor goes, it is subjective. I can't tell you whether or not you should find it funny. But it is important to understand why it is considered offensive, so that you don't outright dismiss people who might not view the joke the same way as you. You might not agree with their take on it, but you should at least try to understand it from their perspective.
In this case, the joke is that a man killed himself because he slept with a man who he thought was a woman. It's impossible to know from the details given whether the person in question was actually trans, or a crossdresser, or something else. But it is perfectly understandable that someone who is trans, or is close to someone who is, would read it that way. And the story would likely be one that hits close to home: getting close to someone, then that person finding out they were trans, and instantly being repulsed. In this case, it's not hard to read it as "sleeping with a trans person is a fate worse than death". So whether or not the joke is funny to you, can you at least see why a person with a very different life situation from yours could read that joke and find it it be an attack on their very identity?
I'm not trans, and I don't have any close friends who are, so I can't speak too much on the matter. But I think we should all try to be more understanding of the feelings of others. Whether the joke is offensive, or whether offensive jokes are okay is a whole other matter. But when someone tells an potentially offensive joke, we shouldn't just outright dismiss the feelings of others for being sensitive or overly PC without at least trying to understand why they feel that way.
Edit: Well that was bad timing.