Hi Laura - a swinging leg over a jump is a very common issue, and luckily for you with a bit of work it's easy to fix.
Let's first look at WHY your leg swings back. There are two common reasons and usually it's both of them at the same time.
1. You pinch your knee. A very common mistake, but definitely not something you want to do as when you pinch your knee your lower leg comes off and swings as well as your upper body! If you also tend to fall forward/backwards pinched knees can also be a cause of that. Instead of pinching your knees close your ankles and calves around your horses barrel and get all your weight into your heels. You will see and feel a difference!
2. You have weak legs. I highly recommend working out outside of riding, ESPECIALLY if your lower leg swings. Some great exercises you can do anywhere (at home, at the barn, etc!) are lunges, squats, calf raises and standing leg lifts. You can look up YouTube videos on how to do these correctly and if you commit to working out every day, even if just for 15-20 minutes, you'll see results very quickly.
Work on those two things as well as doing lots of no stirrups and over time your leg will become so strong and solid at the girth you'll forget you ever had problems with it swinging back! Best of luck!