Most fitness shoes (running shoes, cushioned trainers) have heel-toe drop that compromises form on squats and deadlifts. Flat-soled shoes (Vans, Converse, weightlifting shoes, or barefoot if gym allows) produce better movement patterns.
What to wear for what
Squats and deadlifts: flat-soled or weightlifting shoes (raised heel for squats helps some). Pressing movements: any stable shoe. Cardio: cushioned running shoes. Don't use one shoe for all activities.
If knees hurt during squats, check footwear first. Cushioned trainers force forward knee tracking that stresses joints.