While it might seem like "compet" is the root word, it's actually derived from the Latin word "competere," meaning "to strive for, to be suitable, to be adequate." The prefix "com-" adds the meaning of "together" or "with."
So, "competent" literally means "striving together" or "being adequate together," referring to the ability to do something well and effectively.