Poor grades in courses related to my PhD thesis. Is that an indication to my research and future academic career potential?
My advisor says the grades and courses are a formality and I should focus on my research as I will learn more by doing than through any coursework.


Your advisor is right.  Listen to him.  Class in an engineering Ph. D. program mean very little.  Research is more important by an order of magnitude.