When presidents are elected with popular mandate, it is very easy for the presidents to pass any laws that he/she wants because their sheer popularity would give overwhelming public support that put pressure for the opposition to conform.
Since Kennedy was elected by a slim margin, a large portion of public still oppose his policies during earlier years of his presidency. This make it easy for his opposition to limit his movement so he can't pass the policy that he wants.