It's called root beer because sometimes it's made from certain types of roots.
According to Wikipedia: "homemade root beer is made from concentrate or (rarely) from actual roots" "The alcoholic version is made from a combination of vanilla, cherry tree bark, licorice root, sarsaparilla root, artificial sassafras root bark flavoring (the natural form is mildly carcinogenic), nutmeg, anise, and molasses among other ingredients in some cases including caffeine."