The Swede was beaten to death with a heavy object.
German police said the 26-year-old had not revealed his motives.
“He confessed under interrogation and told us things that only the murderer could know,” police spokesman Nikolaus Brenner told news agency TT.
Police were able to confirm that the two men knew each other.
The victim was found on Wednesday afternoon after his landlady, who lives in the same building, called the police to say she had not seen the Swede for several days and his post box had not been emptied.
The 64-year-old had lived in Germany for over twenty years. He spent the last four years of his life in the small town where he was murdered, 50 kilometres north of Stuttgart.