Every MIDI note consists of two messages, a NoteOn and a NoteOff. Each one has a note number and a channel (also a velocity, but that isn't relevant here). The MIDI standard stresses that it is invalid to send a second NoteOn for the same note number on the same channel before a NoteOff for the first NoteOn. It is more or less impossible to do this with a physical MIDI controller such as a keyboard, but remarkably easy to trigger when editing in a DAW—simply overlapping two instances of the same note will do it.
Ardour offers many options for how to deal with instances where you overlap two instances of the same note. Which one to use is a per-session property and can be modified from Session > Properties > Misc > MIDI Options.
Changing the option in use will not retroactively make changes—it will only affect new note overlaps created while the option remains chosen.
Ardour does not check for note overlaps across tracks or even across regions. If you create these, it is your responsibility to deal with the consequences.