Typically, you can claim Original Routing Credit (ORC) for the flights you were originally booked on. If you are rebooked on an airline on a different alliance, you can claim duplicate credit for membership in that alliance too.
Useful thread for AA: https://www.flyertalk.com/forum/american-airlines-aadvantage/1586992-faq-involuntary-reroute-original-routing-credit-orc-master-thd.html