Dementia. Too wide to describe here, but u can google the word & get full description of causes of cognitive deficits. Summary is that there are either genetic such as fragile x syndrome, fixed such as brain injury, slowly progressive such as infection, a feature of other conditions such as parkinson's disease, or rapidly progressive dementias such as organ failure.
Many causes. Dementia can be caused by a host of environmental and genetic causes - many of them quite rare. Generally speaking, you can potentially reduce your risk of dementia by eating balanced diet, staying a healthy weight, managing your chronic diseases adequately (e.g. Diabetes, high blood pressure, depression), and keeping your mind sharp by maintaining a good social network and new learning.