I read that hash chaining can be used to prevent hash collisions, while the chosen prefix attack allows hash collisions for algorithms like MD5. How are they related? Does hash chaining prevent the chosen prefix attack?
Hash chaining does not itself prevent hash collisions. It sounds like you might have walked away with the wrong lesson from your reading. You might want to read about the Merkle-Damgaard construction, which takes a collision-resistant compression function (for fixed-length inputs) and shows how to extend it to a hash function (for variable-length inputs). Note: to prevent collisions, you need the compression function to be collision-resistant, and you need to use a proper chaining scheme.
Most modern hash functions, including MD5, use Merkle-Damgaard or some other chaining scheme. Obviously, in the case of MD5, it doesn't prevent the chosen-prefix attack on MD5.