Like most words, it comes from Latin. Earth translates to 'terra'. Terra means dirt/soil, but when they realized that we are on a big flying ball of dirt they used the word terra for world, as in our world. And when that happened, the definition of earth also expanded to meaning world, instead of just dirt.
From website: "The name Earth originated from the 8th century Anglo-Saxon word erda, which means ground or soil. In Old English the word became eorthe, then erthe in Middle English. Earth was first used as the name of the planet around 1400.