Marcomf seems to have a good understanding of the word. When used to refer to an inanimate object, it merely means "object, thing, etc." Obviously, "the bad boy" must be visible, being discussed currently, etc. or others will have no idea what you are talking about. It is a positive adjective. The speaker clearly admires the object, likes it, respects it, etc.
Give me that bad boy. = Give me that object.
Have you seen this bad boy? = Have you seen this thing?
I just bought a big car. Do you want to go for a ride in the bad boy?
Note that when it is used to mean an object, it is always "bad boy" and never "bad girl". ("Always" and "never" are strong words. Surely someone will find some obscure use of "bad girl", but I don't recall ever hearing it used.)
When used to describe a person, the usual meaning is "misbehaved, naughtly, etc." Sons are told by their mothes "to be good boys" or "not to be bad boys". The term does not mean the males are criminals, terrible people, etc. And, by the way, the use of "boy" does not restrict it to young males. President Obama "can be a bad boy" if he does something you disapprove of.
"Bad girl" usually means also usually means "misbehaved, naughtly, etc.", but if often has the meaning "promiscuous". People say in jest, "Good girls go to heaven, but bad girls go everywhere." Maybe they are right.