Muscles function only by contracting. This makes it necessary for one end of the muscle to be fixed and the other mobile. Take the bicep for example. Its origin is at the shoulder and its two heads connect to the bones of the forearm, the radius and ulna. Now, had the muscle not been fixed at one end, and contracted, it would pull both our shoulder and forearm together resulting in an ineffective movement. The desired motion is to lift the forearm (proximal and distal movement) which can only be achieved if the bicep is fixed at the shoulder and allowed to move at the forearm.