Dementia affects parts of the brain that control a person’s ability to control their own responses. The most important thing to understand is that this behavior is caused by damage in their brain, it’s not something they’re doing on purpose.
It might seem strange that someone you once knew as proper or respectful might suddenly be showing sexually inappropriate behavior.