Why do my disc brake calipers fall out of alignment?
There could be a few possible issues here:
1: You’re not tightening the bolts enough. Take the bike to a bike shop, or even a car garage, and have them torque the bolts down properly with a torque wrench. Additionally, make sure to use threadlocker on the bolts, which is a special type of glue that prevents them from loosening due to vibrations.
2: Your bike’s caliper mounts are not faced properly, meaning that they are not flat and square. This is a more complex issue that can be resolved either by getting the bike warrantied, or having a bike shop machine the mounts down to get them flat. See Weiwen’s comment for details.
3: Your rotor isn’t true. Realigning the caliper won’t fix this. To diagnose this issue, watch the gap between the rotors and brake pads as the wheel spins. If it pulsates or the rotor briefly rubs, then the rotor is not true. Carefully use a clean adjustable wrench to bend it straight again, a little at a time.
4: Your brake piston seals are dirty, and one or both pistons is not operating as it should. This can be remedied by extending the pistons and cleaning them with alcohol.

                
            
5: As mentioned by Nathan in the comments, if your bike uses quick release hubs, your wheels may twist and reposition themselves under hard braking if your QR skewer is inadequately clamping on the fork/frame. Make sure you are properly tightening the QR skewer, that it is fully closed and not contacting part of the frame, and that you are indeed flipping it and not just using it as a wrench. If the problem persists, consider switching to an internal cam skewer.
If you have thru axles instead, make sure the axles are properly fastened. The exact procedure depends on the axle system your bike uses.