The Department of Homeland Security said it was investigating an officer’s action during an altercation at a New York City immigration courthouse.