The U-shaped part goes by the disposal, and is probably going to be fed with the 1-1/2 inch slip joint curved discharge tube.
I recommend a slip joint p-trap, rather than glued. At the wall will be a trap adapter at an appropriate height and location. One wrong location is right in line with the disposal.
The trap arm of the trap would go into the trap adapter. The trap arm is the horizontal part of the trap.
The trap adapter height should be low enough to let the trap arm be lower than the output from the disposal. The height should ideally be high enough to clear between the bottom of the U and the shelf, with enough clearance to allow assembly and disassembly.
Don't get the trap adapter too wide from the disposal either. There is a little over 2 inch swing in the trap. Also, the disposal can be rotated so that the curved discharge tube can be varied.
I would buy the plastic 1-1/2 inch slip joint trap early, and play with how that can be positioned. The trap arm and U are not usually in the same plane, but they could be.