Inherited from Vulgar Latin *(ec)cu tantum, from Latin eccum + tantum (“so much”).
Practice speaking and memorizing "cotanto" and many other words and sentences in Italian.