One is the subject and the other is the object of a sentence.
Example: John and I went to the park. (I is the subject)
John invited me to the park (me is the object)
People often make the mistake of saying something like:
"She was very good to my mother and I" but it should be "to my mother and me". It's easy to tell if you take out the other person and realize you would never say :"She was very good to I". Also, saying "me and my friends went to the mall" is wrong as you can easily tell if you take the "friends" out of sentence and get left with "me went to the mall". It obviously should be "I went to the mall". Just adding other people doesn't change anything.

