Cubase recording duplicate MIDI notes.

When I go into the MIDI editor to delete a note I find another, identical one, underneath. I seem to recall something similar to this happening in the pre-audio 90s Cubase.

You have a feedback loop going. Make sure your keyboard is in local mode.

It is also possible that your keyboard is sending MIDI on two ports. Check the input for the track. If it is set to “All MIDI inputs” try selecting a specific input. If the keyboard is sending on multiple ports, you should be able to set it to transmit on only one port.
For example, my controller can send MIDI on “USB MIDI A”, “USB MIDI B”.
I believe it can also happen with a “Windows MIDI” port and a “DirectMusic” port.