Indian officials said the accident happened amid a surge of passengers waiting for trains to a Hindu religious festival.