Safety should always be taken seriously when it comes to cooking and consuming food. Despite the many myths around canned food, it’s important to know the difference between a can that is safe to consume food from and one that should be thrown away.
According to the Food Safety and Inspection Service of the Department of Agriculture, food is safe to eat from a dented can as long as the dent is small. If the can doesn't have any issues beyond that, you don't have much to worry about in terms of foodborne illness.
The USDA classifies a "deep dent" as "one that you can lay your finger into," and a deeply dented can should be thrown away. As some dents can be sharp enough to cut through the can's seam, any outside air in the can will allow bacteria to grow, posing a risk of foodborne illness.