What is the difference between these two words? It seems the both mean "to surrender". Can anybody explain the difference?
In many contexts they both mean 1: to concede defeat, stop making an effort, usually with at least some implication of ...finally, after an extended period of resistance.
As a transitive phrasal verb, to give [something] up can also mean either 2: stop doing/having it (as in He gave up smoking five years ago), or to 3: give something to someone [often reluctantly, under pressure] (as in He gave up his bus seat / He gave his bus seat up to a pregnant woman).
Note that He gave up his bus seat for a pregnant woman also occurs, where the sense is perhaps closer to #2 - he stopped using the seat for the benefit of the woman (so she could sit in it).
Though I agree with the other answers, the phrases can represent different nuances. For instance, 'giving up' can refer to resignation, like no longer having a desire to complete something. It can also be a response to someone who is competing with you. Though 'giving in' is more likely to be useful in a case where, say you are playing chess, and you just can't find another move. In this case, you could use either phrase, but 'giving in' would be to accept defeat against what was your ideal desire (to win). In other words, you would have preferred not to 'give up', but you decided to 'give in' anyway. I hope this helps!