How do I select the transistors for this circuit?
The first thing we need to know is how many Amps the motor requires. We already know the motor is 12VDC.
The worst case with a DC motor is when it is stalled - the 'stall current'. Either the motor manufacturer with specify this (hopefully) or you can measure it. Use an Ammeter with the motor stalled and read the value.
Based on these values, we want what is called a 'H' bridge as Tony mentions. For smaller currents, there are integrated circuits that do this. Once you start getting up over around 10Amps, then we need a discrete approach. How do you chose what transistor device? There is no one choice and there are many variables to balance. Designing a 'h' bridge as a first project is not advised.
If all you really want to do is reverse the motor, then use relays. There's plenty of relay boards suitable for the raspberry pi (note the raspi logic levels are 3.3V NOT 5V) that have a suitable transistor and circuit. Relays are pretty hard to kill vs h bridges that one slip might turn them to smoke.
As well, you will want to put a varistor across the motor to suppress inductive spikes that will upset your raspi. Something like a 7mm or greater with a voltage of 14V or thereabouts. I can say conclusively from experience that this is required - a colleague ignored my suggestion and found out the hard way.
If you have batteries or power supplies that can supply many Amps of current, ensure the size of wire is adequate for the current (there are online tables of Ampacity) and that there is a fuse to protect the wire. Otherwise a fault might cause the wire to melt and cause a fire. For 12V there are auto fuses and holders that are easy to source and cheap.