MIDI is short for Musical Instrument Digital Interface. MIDI makes it possible for digital musical tools to communicate with each other. MIDI itself does not make sound, it is just a series of messages like "note on," "note off," "note/pitch," "pitchbend," and more. These messages are interpreted by a MIDI instrument that can create a sound!
A MIDI instrument can be a piece of hardware (electronic keyboard, synthesizer) or part of a software tool (like Soundtrap).
With MIDI it's easy to manipulate notes, for example changing pitch, duration, and other parameters without having to rerecord. Since it does not make sound, but only tells an instrument what notes to play, you can also change the instrument sound after the recording.