You have a couple problems, The 12/2 must end at the point of exiting the building, NM or UF wiring methods are not allowed outside of a structure, you must change over to THWN conductors with an insulated grounding conductor, grounding conductors are not allowed to be bare and must be copper. See 680.21(A)(4)
since your load is 240 volts only, you only need two hots and an EGC, two pole GFCI breakers now come for the most part with a neutral terminal, but if you don't need it, you don't have to use it, as others have said, the white pigtail has to be connected to the neutral bar for the electronics to work in the breaker, but there is no need to have a load connected to the neutral terminal on the breaker. the EGC can only go to the ground bar or neutral bar if this is a service panel, the other end just terminates to the pump ground (EGC) they way you had it, caused current to flow on the neutral terminal of the breaker and the breaker detected it as a ground fault and tripped the breaker.
The NEC does not require a GFCI breaker for a hard wired pump, but I know in most areas, it makes the inspector and the home owner happy.
Sounds like you need to do some reading of article 680, and then if there is something you don't understand , post a question and we can help.
680 can be very confusing if you try to read ahead to fast, and miss key words.
