Suppose a person is doing an incredible job at work (e.g. being very productive and coming up with innovative ideas). Let's assume that this person is a contractor for this company. Are there cases where the company can terminate contractors because they expected them to work at a slower place? For example, it was expected that the contractor was to complete the project in 6 months but instead he completed it in 3 months. Is this a valid reason to terminate a contractor (maybe due to budget constraints, no more project available, etc.)?
Most contracts have termination clauses in them where either party can terminate at any time with a given notice period. If the work is done, then that could well be a reason to terminate early. Read your contract, that's the best way to see what you agreed to with regards to early termination.
From a comment by the OP:
The contract was for 6 months but was terminated in 3 months. I am assuming that this was because all the work was done combined with lack of projects, billing issues, etc. Also why would companies hire contractors instead of full time employees?
Usually, companies hire contractors when there is a specific unit of work that needs to be done and they don't need or want to keep those resources around afterward. Sometimes the project takes longer than expected, sometimes shorter. That's just how it works as a contractor, you're quite literally a temporary resource.
Don't think of early termination of a contract as necessarily something you've done wrong. Ask if you can use them as a reference (given you finished everything well before planned) and move on :)