Something like this is easy (ish!) to set up in Logic, GarageBand's older sibling, as you can assign different tracks to "listen" to different MIDI channels. As Tetsujin suggests, this would mean you simply have to get each MIDI controller to send on a different channel. However, it's unlikely you'll be able to do this in GarageBand, as you can't set different MIDI channels for either input or output for individual tracks in GarageBand. This thread explains that:
GB listens to all channels all the time
EDIT: My answer above explains why you can't record to two different MIDI tracks in GarageBand. Here is a Heath-Robinson-esque solution, which doesn't involve changing MIDI channels. It's the quickest work-around I can think of, maybe somebody will come up with something quicker (Code Golf anyone?!)
If all of the MIDI notes in your piano part are in a different register to your drum part:
- Record both parts in at the same time onto the same MIDI track.
- Open this MIDI region in the Piano Roll window.
- Select all the notes from the piano or drum part only. Cut them (cmd-X). In the image below I played into the drum track then selected my piano notes:
- Right click and Create Empty MIDI Region on the other track. Paste copied notes in.
NB: it's really important that you paste your notes into the right position on the new track. Quantising will help.
If your drum part and piano part have registers that overlap:
- Set your piano MIDI controller to transpose up one or two (or more!) octaves.
- Follow the four steps listed above.
- Move the copied notes back down one or two octaves (depending on your earlier transposition). You can do this by selecting them and pressing shift-alt and the down key.
The main problem with this method, is that you won't be able to hear what you're playing while you record. Either you'll hear all drum notes or all piano notes...