A federal judge was set to hear arguments Tuesday on whether Virginia’s ban on gay marriage should be struck down, which is the position the state’s newly elected Democratic attorney general has endorsed in a move that angered many Republican lawmakers.