It depends what hardware its on.
On a module like a synth, MIDI OUT is where the MIDI signal comes from, sending data to say, a sequencer for explanations purpose.
MIDI IN, on the synth, would be where it takes MIDI data from external hardware, for instance a controller keyboard, or a sequencer.
However this is reversed on other hardware, say a MIDI interface connected to a sequencer. MIDI OUT would go to the MIDI IN on a synth, so you can control the synth.
MIDI IN, would be where MIDI data goes into to the device, say from a controller keyboard.
So lets put this into practice, why would we use these?
Say I have a synth with a keyboard, and a second module which has no keys. I plug the MIDI OUT of my main keyboard, into the MIDI IN on the receiving module. Now I can control the module with my keyboard.
I come to record a section, which is too fast for me too play. I'll connect the MIDI OUT of my interface into the MIDI IN on my synth. I'll connect the AUDIO outputs of my synth into my interface. Now I can sequence the part I can't play with my software, and record the audio while it's being played for me.
Of course you can do FAR more, but this should explain it for you.