The kneecap, or patella, is a sesamoid bone, which means that unlike most bones in the body it grows within the tendons that attach muscles to certain joints. Sesamoids form where a tendon passes over a joint, and their purpose is to protect the tendon and to increase its mechanical effect.
Human knees are placed under a great amount of stress due to walking upright, and the kneecap is there to help maintain the knee’s movement and ability to flex in the correct manner. the elbow does not suffer these stresses, as we (well, most of us) do not walk on our hands. Second, it would seem reasonable that since our knees face forwards (the same direction that we crawl) and our elbows face backwards, the kneecap evolved to protect the knee, whereas the elbow did not require such protection.
Nathanial Marten, Science Museum