If you really just want to know why some US states have anti-sodomy laws that aren’t enforced (and that most people don’t want to enforce), then it’s a pretty simple story. The laws were made a long time ago when attitudes were different. Then the laws were all ruled unconstitutional in 2003, meaning that there hasn’t been any strong incentive to repeal them in the time since.