Since everybody else is throwing derived categories at you, let me take another approach and give a more lowbrow explanation of how you might have come up with the idea of using injectives. I'll take for granted that you want to associate to each object (sheaf) F$F$ a bunch of abelian groups Hi(F)$H^i(F)$ with H0(F)=Γ(F)$H^0(F)=\Gamma(F)$, and that you want a short exact sequence of objects to yield a long exact sequence in cohomology.
I also want one more assumption, which I hope you find reasonable: if F$F$ is an object such that for any short exact sequence 0→F→G→H→0$0\to F\to G\to H\to 0$ the sequence 0→Γ(F)→Γ(G)→Γ(H)→0$0\to \Gamma(F)\to \Gamma(G)\to \Gamma(H)\to 0$ is exact, then Hi(F)=0$H^{i}(F)=0$ for i>0$i>0$. This roughly says that Hi$H^{i}$ is zero unless it's forced to be non-zero by a long exact sequence (you might be able to run this argument only using this for i=1$i=1$, but I'm not sure). Note that this implies that injective objects have trivial Hi$H^{i}$ since any short exact sequence with F$F$ injective splits.
Now suppose I come across an object F$F$ that I'd like to compute the cohomology of. I already know that H0(F)=Γ(F)$H^{0}(F)=\Gamma(F)$, but how can I compute any higher cohomology groups? I can embed F$F$ into an injective object I0$I^{0}$, giving me the exact sequence 0→F→I0→K1→0$0\to F\to I^{0}\to K^{1}\to 0$. The long exact sequence in cohomology gives me the exact sequence $$0\to \Gamma(F)\to \Gamma(I^{0})\to \Gamma(K^{1})\to H^{1}(F)\to 0 = H^1(I^{0})$$
0→Γ(F)→Γ(I0)→Γ(K1)→H1(F)→0 = H^1(I0)
That's pretty good; it tells us that H1(F)= Γ(K1)/im(Γ(I0))$H^{1}(F)= \Gamma(K^{1})/\mathrm{im}(\Gamma(I^{0}))$, so we've computed H1(F)$H^{1}(F)$ using only global sections of some other sheaves. We'll come back to this, but let's make some other observations first.
The other thing you learn from the long exact sequence associated to the short exact sequence 0→F→I0→K1→0$0\to F\to I^{0}\to K^{1}\to 0$ is that for i>0$i>0$, you have $$H^{i}(I^{0}) = 0\to H^{i}(K^{1})\to H^{i+1}(F)\to 0 = H^{i+1}(I^{0})$$
Hi(I0) = 0→Hi(K1)→Hi+1(F)→0 = Hi+1(I0)
This is great! It tells you that Hi+1(F)=Hi(K1)$H^{i+1}(F)=H^{i}(K^{1})$. So if you've already figured out how to compute i$i$-th cohomology groups, you can compute (i+1)$(i+1)$-th cohomology groups! So we can proceed by induction to calculate all the cohomology groups of F$F$.
Concretely, to compute H2(F)$H^{2}(F)$, you'd have to compute H1(K1)$H^{1}(K^{1})$. How do you do that? You choose an embedding into an injective object I1$I^{1}$ and consider the long exact sequence associated to the short exact sequence 0→K1→I1→K2→0$0\to K^{1}\to I^{1}\to K^{2}\to 0$ and repeat the argument in the third paragraph.
Notice that when you proceed inductively, you construct the injective resolution
0→F→I0→I1→I2→...
$$0\to F\to I^{0}\to I^{1}\to I^{2}\to\cdots$$
so that the cokernel of the map Ii-1→Ii$I^{i-1}\to I^{i}$ (which is equal to the kernel of the map Ii→Ii+1$I^{i}\to I^{i+1}$) is Ki$K^{i}$. If you like, you can define K0=F$K^{0}=F$. Now by induction you get that
$$H^{i}(F) = H^{i-1}(K^{1}) = H^{i-2}(K^{2}) = \cdots = H^{1}(K^{i-1}) = \Gamma(K^{i})/\mathrm{im}(\Gamma(I^{i-1})).$$
Hi(F) = Hi-1(K1) = Hi-2(K2) = ... = H1(Ki-1) = Γ(Ki)/im(Γ(Ii-1)).
Since Γ$\Gamma$ is left exact and the sequence 0→Ki→Ii→Ii+1$0\to K^{i}\to I^{i}\to I^{i+1}$ is exact, you have that Γ(Ki)$\Gamma(K^{i})$ is equal to the kernel of the map Γ(Ii)→Γ(Ii+1)$\Gamma(I^{i})\to \Gamma(I^{i+1})$. That is, we've shown that $$H^{i}(F) = \ker[\Gamma(I^{i})\to \Gamma(I^{i+1})]/\mathrm{im}[\Gamma(I^{i-1})\to \Gamma(I^{i})].$$
Hi(F) = ker[Γ(Ii)→Γ(Ii+1)]/im[Γ(Ii-1)→Γ(Ii)].