Viscosity has to do with the shape of the molecules in the liquid, which determines the extent to which adjacent molecules can get tangled up with one another. Lots of tangles means lots of viscosity. No tangles means very little viscosity. This also requires those molecules to build weak bonds between each other where they are touching. No bonds means almost no viscosity even if the molecules get tangled.
Density is determined by the atomic weights of the atoms forming the molecules or, if there are no molecules, just by the atomic weights of the atoms themselves. So liquid mercury is very much denser than liquid water or liquid hydrogen. Note that mercury has very low viscosity (the mercury atoms can't get entangled) even though it has very high density (lots of protons and neutrons in the nuclei).