The Cape and Islands district attorney’s office said the child died Wednesday at Mass General Hospital, days after allegedly being left in a vehicle for hours.