This is what was meant:
Yes, you are capable of sitting there. But you are not permitted to do so.
It's using the following senses of the words (from Merriam-Webster).
Can:
1 a : be physically or mentally able to
// He can lift 200 pounds.
May:
1 b : have permission to
// you may go now
Both can and may have multiple senses, and frequently can is used to express permission (rather than capability) in the sense of may quoted here.
So, the response from the guard, drawing a distinction between the two, is a kind of snide reply—inferring one sense of can to the person asking the question, rather than what would normally be assumed. No doubt the guard actually knew what the person was asking and just wanted to put them down subtly.