MIDI is just a stream of instructions, like:
- "Tell channel 1 to turn on note 60"
- "Tell channel 2 to turn off note 72"
- "Tell channel 3 to set parameter 1 to value 231"
There is a set of conventions such as:
- Channel 1 is piano, 34 is electric bass, etc.
- Parameter 1 is modulation, 7 is volume, 64 is sustain, etc.
This is called General MIDI (Wikipedia).
General MIDI was specified later than MIDI itself. Users of MIDI are free to use any instrument on channel 1. You don't even have to control an instrument -- MIDI can be used to control lights, or anything else.
If you get a MIDI file from the internet, it's likely to be written for GM, but sometimes it's not.
Imagine the simplest case of a MIDI file - a recording of one person playing a piano part on a keyboard. It's a bit like getting a robot to exactly mimic the movements of a pianist, then putting the robot at the keyboard of a different instrument.
If the robot is at a good piano, it'll probably sound good. This piano might not have exactly the same response of key velocity to volume, so expression will sound subtly different. But it'll sound pretty good.
If you sit the robot at a toy keyboard, it's likely to sound awful. A good musician could probably coax a decent sound out of that toy keyboard. But here the musician has "played" a nice instrument and had their input moved to a different instrument, so they can't take account of its limitations.
Then there's all the other parameters. What effect does "modulation 127" have on the sound? How much does "100 pitch bend" change the pitch? Even when GM specifies these, not all implementations get it right.
Then multiply it by a number of instruments, and take into account that if you were mastering your own piece of music you'd be tweaking aspects that GM doesn't specify, and it becomes obvious why MIDI playback can sound terrible.
A high quality "sound font" -- the set of things that translate events into sounds -- can improve matters, but even then you don't reach the standards of a full professional recording.
Many electronica records are made entirely from MIDI sequenced instruments -- but the musicians are also carefully configuring their instruments and effects to get the sound they want.
There is great fun to be had sending MIDI files to the built-in sounds of the cheapest sound card you can find, and playing "guess the tune". Or swapping instruments around.