Figuratively, a bad egg is someone who is often involved in trouble, such as petty crime, vandalism, and so forth. Ex.: "I don't want you hanging around with that boy! He's a bad egg. He'll get you arrested someday!" Here, "that boy" is well known as a delinquent and is involved with shady things (though not necessarily on a serious level... yet).