Its usually the piston gets stuck and wont go back into the caliper the rubber seal gets damaged and lets debris in or water the piston then corrodes and the rust will stop it moving in and out

If it is the piston stuck id suggest getting another from a breaker or the motor factors and swapping them around its the easiest way to fix it at home