Audacity is used to edit sound files. A MIDI file does not actually contain sound. It contains commands to be sent to MIDI instruments (like the speed of the song, when to play what note and how loud). The reason it plays in your computer is that it has some 'default' software MIDI instruments (you can also send them to for instance a keyboard, synthesizer or drumcomputer).

To edit a midi file you can use an arrangement tool like Muse or Rosegarden (I am unsure how well they export to MIDI, but I know they can import). If you want to edit the music in an audacity way, you'll first have to find a way to record what is played, for instance record the output of your soundcard somehow.

when working with several midi apps you have an option to edit via import with audacity, an additional feature of audacity rather than its purpose to record and edit audio files. do not do a lot of midi these days so not sure what the beauty is exactly.

Audacity currently supports displaying MIDI files if you import them using Import MIDI in the Project menu.

Audacity does not support playing, recording, or editing MIDI files. It does not even support saving MIDI Tracks in a project file.

The current functionality is useful to only a small group of people who are studying algorithms that relate MIDI data to audio data and simply wish to see the visual representation of the MIDI data and how it lines up with the audio data.