You need:
* A MIDI sequencer that can send MIDI messages to more than one MIDI output device, and
* A software MIDI synthesizer that can play with no latency.
One possible solution: Cakewalk by BandLab is free digital audio workstation software that includes both of those things.
Example steps for Cakewalk by BandLab:
1. Open a MIDI file.
2. Go to the Insert menu, choose Soft Synth, then choose Cakewalk TTS-1. Ensure "Simple Instrument Track" and "Ask This Every Time" are checked and everything else is unchecked, then click OK. A new track representing settings for the software synthesizer is added at the bottom of the Track List window.
3. In the Track List window, drag the pane divider to the right until you can see the output port settings for all tracks at once.
To hear the track on the computer speakers, set the output to "Cakewalk TTS-1".
To hear the track on the device connected to the USB MIDI cable, set the output to "USB MIDI Interface" (or whatever name your USB MIDI cable appears as).