There is no hard and fast rule for deciding what to set u equal to. Rather, it is one of those things one learns by experience. A useful -- although not 100% reliable -- rule of thumb is this: Put u equal to the expression that is being raised to an exponent or occurs in the exponent.
Here, the quantity 3x2+3 is being raised to a power, so we set u = 3x2+3.