For example, in Spider-Man (at least the film from 2002), Peter Parker is friends with Green Goblin (or his son?), and in X-Men, Wolverine's "brother" becomes Sabretooth.
Why this is so popular?
Science Fiction & Fantasy Stack Exchange is a question and answer site for science fiction and fantasy enthusiasts. It only takes a minute to sign up.Sign up to join this community
This isn't specific to comics. It's an age old literary archetype, and can be found in pretty much every kind of story telling medium that you can think of. TV Tropes has two entries for it (click through at your own risk) Evil Former Friend and Face Heel Turn. And as huge as these lists are, they have large gaping holes in them!
In literature a character who remains the same through the book is referred to as two-dimensional, whereas someone who develops in any direction, as a result of life experiences, is referred to as three dimensional. These characters are always so much more fascinating on a really deep level, because they are a good way of exploring how everyone is a mixture of positive and negative qualities. This kind of character lets the author show subtle changes in a person bit by bit. With the earlier closeness of Superheroes and their enemies, you get the added thrill of knowing how good can turn to evil so easily, yet gradually...and the villain becomes a negative image of the hero. This is also a nice way of highlighting the hero's wonderfulness, his ability to self doubt, and so on.
Because it immediately makes the conflict between those characters more personal and thus more dramatic. Perhaps most importantly: the main character cannot simply treat this enemy as just another opponent of the week. Either there was a betrayal and the hatred is extra strong between them, or external forces turned them against each other, in which case the main character will find the conflict painful and will want to redeem their former friend.
And at the same time, a shared past offers endless possibilities for developments in the conflict: the characters know things about each other which they can use for manipulation, there are mutual friends who now have to deal with conflicting loyalties, etc.