Let's focus on global supersymmetry; Fayet-Iliopoulos terms in supergravity are a lot more subtle.
You are right that 'the $D$-term' is just a particular piece in the expansion of a superfield. When people talk about a "Fayet-Iliopoulos $D$-term", it refers to adding some multiple of the $D$-term of a $U(1)$ gauge field to the Lagrangian:
$$
\mathcal{L}_{\mathrm{FI}} = \xi\, D ~,
$$
where $\xi$ is a constant with dimensions of mass squared. This is gauge-invariant for a $U(1)$ gauge field, and under supersymmetry, it transforms by a total derivative, so the action is invariant.
Such a term may look strange, but remember that $D$ is an auxiliary field, which means it doesn't have a kinetic term. This means that its equation of motion is just algebraic, and we can solve it and substitute the solution back into the Lagrangian. Let the scalar fields in the theory be denoted $\{\phi_i\}_{i=1,\ldots,N}$, where $\phi_i$ has charge $q_i$ under the $U(1)$. With the FI term included, the solution for $D$ is
$$
D = -\left( \sum_i q_i |\phi_i|^2 +\xi \right) ~.
$$
The scalar potential includes a term $\frac{1}{2}D^2$, and when you expand this out, you get a bunch of quartic interactions which are independent of $\xi$, a bunch of mass terms proportional to $\xi$, and a constant $\xi^2$ term.
To see why this is an interesting thing to do, remember that supersymmetry is unbroken if and only if $D = 0$, and also $F_i = 0$ for each $i$, where $F_i$ is the auxiliary component of the chiral superfield $\Phi_i$. You can see that when $\xi \neq 0$, $D=0$ is impossible unless $\phi_i \neq 0$ for at least one value of $i$ (with $q_i \neq 0$). But $\phi_i \neq 0$ means that the gauge symmetry is broken. So either gauge symmetry or supersymmetry must be broken!
Actually, gauge symmetry or supersymmetry or both may be broken in a model like this; I recommend playing around with a simple example -- two chiral fields, $q_1 = e, q_2 = -e$, with mass term $\int d^2\theta\, m \Phi_1 \Phi_2$ -- and work out for which values of $m, \xi$ supersymmetry and/or gauge symmetry is broken.