There are many different factors that could be cited to account for this. Let us look at the two most important.
First, there was the Civil Rights Movement. The movement had managed to get more and more support from the American public so there was pressure on Congress to pass this law by 1964.
Second, there was the presidency of Lyndon Johnson. In contrast to President Kennedy, President Johnson was a master of getting legislature through Congress. He was able to use these skills to help coax Congress into passing the law.
Overall, then, the Civil Rights Act of 1964 was passed because of pressure from the public (due to the Civil Rights Movement) and from the White House (which was more persuasive because of Johnson's greater skills in this area).