Do you want to record audio from the piano [its own internal piano sounds] in to GarageBand, or just use the piano's MIDI output to play sounds from piano Instruments in GarageBand? [AFAICT you should be able to do either]..
If you just want to play GB's [piano] Instruments from the keyboard, try connecting the P45 to the computer via USB [with a USB B->C adaptor, if needed], and see if it triggers GB Instruments -- if it doesn't, go to GB Preferences > Audio/MIDI and hit Reset MIDI Drivers, then try again..
For anything more elaborate than that.. Well, details on the P45's MIDI/Computer connections are supposedly found in these two Yamaha documents, which cross-reference each other in a very un-helpful way..
If you're completely new to both GB and MIDI in general, I've linked to one of our basic GarageBand courses, which explains a bit [see video # 2, below]..