Why is it so important we brush our teeth?

Growing up, we were constantly told how important it was for us to brush and floss our teeth. The toothbrush wasn’t invented until 1938, and floss wasn’t invented until 1819, so how did people keep their teeth clean before that?