Are unimpressive grades in core courses an indication of not being competent for a career in the field? I have recently passed my qualifiers and research proposal. My research is in computational mechanics. I had two courses (continuum mechanics and finite element method) as part of my research related courses. I will be using the concepts learnt in the courses in my research, though my research will be more applied than theoretical, so will involve utilizing a commercially available software and develop few additional routines for it.

Now, I scored B+ in both the courses (the minimum grade required for being eligible for qualifying exams was a B-). I struggled through few concepts but fared fairly well in the qualifiers and answered most of the questions asked by the committee.

However, I am concerned that my average grades might be an indicator that I might not be fit for the field I have chosen to build a career in. Now, I am confident that I will manage to adequately complete my PhD thesis and publish papers as required. 

But, I am worried that academia is going to be a closed door for me. Eventually, if I get tenure track position after my PhD, I will have to teach these subjects (There's no teaching assistantship opportunities in my department for me), and how will I be able to teach something in which I fared poorly? Also, I will have to do theoretical research work after my phd, and I will not fare well in that. What should I do?
You are overthinking it. First, if you complete your degree and get that first academic job, no one will care anymore what your grades were. 

Second, you seem to be implying that your learning ended in those subjects with the courses you took. I think that isn't very likely. 

In fact, for teaching purposes, it is sometimes valuable to have had the experience of struggling earlier, so that you have an appreciation for those students that don't find everything easy, or even trivial. You will probably be required to teach students who are not at all like those who go on to earn doctorates - i.e. not at all like you. Every student is different and the strugglers need to be taught along with everyone else. 

There are many reasons for mediocre grades, though yours are a bit better than that. I suspect that things may have been hectic at the time and there wasn't time enough to reflect and gain deeper insights. But that level of insight isn't forever closed off to you. 

As for the research, in many fields the research is so deep and narrow that it is almost necessary to give up a deep knowledge of other somewhat related, but not essential companion fields.