A car bomb exploded near a hotel and restaurant in the Somali capital on Thursday, killing at least eight people, police said.