I had lots of injury in gym and I kept hearing it is because of bad form. I am sure i was doing correct form in half of them. Does proper form never cause injury?
It's not that black and white.
Yes you can still get injuries using proper form because injuries are related to more factors than just form, but you can reduce the risk of getting an injury by using proper form on during an exercise.
It also has to do with how often you use proper or bad form. If you work out for years and years and u constantly use bad for you will almost guaranteed get an injury, while if you only use bad form once it might not have as big of an impact.
To sum it up: Using proper form will greatly reduce your changes of getting an injury, but you cannot prevent injuries with 100% certainty just by using proper form.
For me, form is everything when it comes to preventing injury. "Men's Health's Big Book of Exercise" is my go-to for clear, quickly understandable directions on proper form. It also has detailed workouts. The Kindle version is super cheap and you can access it on your phone, while at the gym. Edit: I should add that physical therapy has helped teach me how to strengthen critical muscles and prevent injury. For example, I had lots of shoulder problems until a physical therapist taught me how to target specific muscles with simple, very low-weight exercises. This also helped with my knee and shoulder.