There are a few nuance things to consider. The most important one is that there isn't a 1:1 correlation of all words between Japanese and English. Therefore, a specific word like "can" isn't always exactly translated as one specific word into Japanese. There are, however, ways to express this kind of expression with different words. Think on how in English, there are also ways to reword these questions:
Can I buy a fruit? -> Am I able to buy a fruit?
Can I ask you a question? -> Is it alright if I asked you something?
The best approach is to find out how to ask these questions in Japanese, and learn the nuances between the different applications in relativity to other similar questions within Japanese.
As in your example:
(verb) + ことができる = to be able to do (verb)
Note that this particular structure emphasizes on your personal ability to be able to do something rather than the morality or accessibility of doing something. It also has no bearing on whether this affects another party, this is strictly on your own ability at a specific place and point in time. This is the kind of "can" question that is closest to a true "can" form, where できる = to be able to do = can.
Keep in mind that the scope of the ability is referring to the subject of the sentence, which in this case is implied to be you. If you ask this to someone, you're asking about their ability instead.
As for your other example:
(て-form verb)+もいいですか。 = Is it alright if I (do verb)
This is the kind of "can" question where you are asking for permission to perform an action. The emphasis here is on the response of the other party onto which you are asking this.
You might liken these differences to when teachers (may have) used to hark on you about saying "May I" instead of "Can I" because the response to "Can I go to the bathroom?" may have included a very snarky and sarcastic "You CAN go to the bathroom, but you may not go." (meaning, you have the ability to go but you are not allowed).