A man died and two were hurt by an early-morning fire that tore through a Brooklyn apartment building Sunday, police said.