U seem to have developed some sort of locking of the knee. A hard swelling could arise from anywhere in the three bones of the joint - thigh, leg or ur knee cap. Since it is hard, i presume it is a "LOOSE BODY" in your knee - its origin can be from any of these structures.
Please consult an orthopedician - u may need MRI
to find out where it is arising from. Treatment is different for different conditions - i cannot throw any light now with this limited information.