In Arabic grammar, every verbal sentence (جملة فعلية) consists of at least a فعل (verb) and a فاعل (subject/doer of the action). The فاعل is the noun that performs the action described by the verb. If the verb is transitive (متعدٍّ), there will also be a مفعول به (direct object) that receives the action.
In the sentence أكل محمد التفاحة (Muhammad ate the apple), the verb is أكل (ate), the doer of the eating is محمد, and the thing that was eaten is التفاحة. Therefore, محمد is the فاعل. The فاعل always comes after the verb in the standard Arabic verbal sentence structure (فعل + فاعل + مفعول به). The word أكل is the فعل (verb), not the فاعل. The word التفاحة is the مفعول به (object), the thing acted upon, not the doer.
Exam tip: To find the فاعل, ask "who did the action?" The answer is always the فاعل. Do not confuse it with the فعل (the action itself) or the مفعول به (what the action was done to).