Asking for a recommendation from a professor who I did bad in his courses
If they were genuinely bad grades, I would advise against using this professor. But a B+ is not "really" a bad grade, even though you might have done better.

Some professors are stricter than average, and a B+ from them is the equivalent of an A- or even an A from most others. This could well be the case here. One of my friends was told that he was in the "top 5" of his class. But there were only two A's, which explains his B+. If this is the case with you, this professor is in the best position to vouch for the quality of your work, and the fact that it would be worth an A elsewhere.

In your shoes, I would schedule a meeting with the professor to find out how he feels about your work, and about recommending you.  It could be that you were one of his best students that he'd recommend above most others (one student on another post reported being the "best student" in a class where he got the highest grade, 90%). On the other hand, he may think that you are "nothing special" in which case you should go another way. 

Up to now, everything I've written is "speculation," so you need to find out what the "facts" are before making a decision.