Lead was used in paint for several reasons, one of which is that certain types of lead compounds provide pigment for the paint. White lead and vivid yellow lead chromate are two examples. White lead paint was formerly used to paint wood surfaces in homes. Its insolubility in water made paint that used it as an ingredient a durable, washable surface. White lead also neutralized the acidic properties of some of the other ingredients in paint, providing a durable coating that resisted cracks.  Paint containing lead also dries quickly. 
The United States has banned lead paint in household paints since 1978, but lead paint is often still present in homes that were painted prior to that date. Ingesting the paint can lead to damage to the nervous system and kidneys, stunted growth and delayed development. Because the paint chips have a sweet taste, they are particularly dangerous for children, who are likely to eat them. Another danger that lead paint presents is a reduction in sperm count in men, leading to decreased fertility. Lead is also most likely a carcinogen.