I'm working at a research institute at university, the atmosphere is quite relaxed and it is quite common to make jokes. Today, a colleague and I went to the the kitchen to grab a coffee and wanted to pick up another colleague on the way. As usual the door to the colleagues office was open and we knocked on the frame of the door. The colleague in the office replied with "Oh no it's you" which also was ment as a joke, at least I interpreted it this way. In then closed the door of his office as a reply to his cheeky behaviour. Later that day the colleague approached me and told me that he was quite angry about me closing his door because he interpreted as I wanted to say "shut up". I was quite puzzled and couldn't find an appropriate answer to him since I thought we both just made jokes. How should I handle such a situation? I want to avoid having missunderstandings but at the same time it's just part of the culture to make fun of somebody. Additional info: he is a postdoc and I'm a PhD student. He also mentioned that he had slept too short and was not in a good mood this morning.
Just explain that you meant it as a joke and apologize if it didn't come across properly. Then try your best to ignore the ensuing awkward silence and move on. Given the environment you describe, I would expect all will be forgotten by the next day.
How to deal with coworkers bad mood?
Just accept it and try to be considerate. Bad moods happen to everyone, possibly even to you sometimes. When you detect that someone is in a funk, be kind enough to put joking and teasing on hold and either leave them alone or give them a bit of encouragement, as the situation demands.
It sounds like you and your colleague had some miscommunication, and he later approached you to either apologize or to at least talk it over. The right thing to do there is to take some or all of the blame, shake hands, agree that it feels good to have sorted out that mess, and move on to happier topics.
These things happen. Whether they resolve quickly or continue to fester depends on you dealing with them honestly and openly, and not holding on to grudges.
"oops, sorry", then let it be. That's the best way to deal with any faux pas, be it a coworker's bad mood or a joke that falls flat, or in this case both.
The less a deal is made of it, the less a deal it will be.