Ateef Sheikh died after being stabbed by Winson Maisnam Singh, 23, on their fourth floor flat of the six-storey building in Akbar Shah area last night, the police said.
Mr Sheikh, a final year student of the private University of Science and Technology Chittagong, was rushed to USTC hospital and later to Chittagong Medical College Hospital, where doctors pronounced him dead.
Mr Singh was rescued by other roommates when he tried to hang himself. Police suspect Mr Singh stabbed Mr Sheikh and then tried to hang himself.
"Four Indian medical students hired the apartment where one of them killed a fellow student and then attempted suicide," a police officer said.
Other than the duo, two others, including a woman student of the same university, stayed in the building, police said.
Police said there were several wounds from a sharp weapon on Mr Sheikh's body.
"The fellow residents of the apartment tried to save both of them by taking them first to the USTC Hospital and then the (state-run) Chittagong Medical College Hospital (CMCH) where doctors declared Sheikh dead," said officer-in-charge of the city's Akbar Shah police station Alamgir Hossain.
Mr Singh was being treated at the facility but his condition was critical, CMCH doctors said.
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections.