When people see a cat rolled over on the back with their belly exposed, they usually interpret it as an request for a belly rub since that behavior is often seen in dogs. They are then surprised (and sometimes offended) when the cat attacks their hand. Unlike dogs, many of whom enjoy belly rubs, for most cats their belly is off limits. When a cat shows their belly, they are communicating that they trust you and are comfortable enough in your presence to expose the most vulnerable part of their body. In the wild, exposing your abdomen to a potential predator or enemy could be fatal since the abdominal organs are very vulnerable.
Dogs will roll over and show their belly to another dog as a sign of deference or submission. Over the many years that dogs and humans have lived and worked together, many dogs have come to enjoy having their bellies rubbed and scratched. There are very occasional cats who have come to enjoy this type of contact but in general it is safe to assume that a cat will not respond favorably to an attempted rub. You should still take the behavior as a complement though, since it means your cat trusts you with their life.