Both words are auxiliary verbs.
Our teachers in high school insisted that can expresses ability and that may grants permission. But children do not ask if they may do something. They ask if they can do something. They get this idiomatic expression from their parents, who say:
After you do your homework, you can go to the movie. In informal speech, this expression is perfectly acceptable. It’s especially useful for negative questions:
Can’t I go to the movie? To use may would require:
Mayn’t I go to the movie? Either sounds unnatural.
May I not go to the movie.
But in formal writing, you should restrict can to a showing of ability and may to a granting of permission. Further, to show a possibility, use might.
Example: She can write well because she knows that writers may use certain colloquial expressions.