15 of 18 more from that link

Here's how, using an approximate patched conic technique.

The $$\Delta V$$ using instantaneous (e.g. chemical propulsion) maneuvers can be determined by repeated application of this equation that simply says that the total energy is the sum of the kinetic energy and the potential energy:

$$\mathcal{E}=\frac{v^2}{2}-\frac{\mu}{r}$$

where $$\mathcal{E}$$ is the total energy per unit mass of the object or the "specific energy", $$v$$ is the velocity of the object at the current position, $$\mu$$ is the GM of the central body, i.e. Newton's gravitational constant times its mass, and $$r$$ is the current distance from the center of the central body.

The key is that the total energy of the object is a constant of motion over the orbit.

We will also use the fact that orbits are ellipses, and this equation, which determines that constant of motion from the apses of the orbit, i.e. the radii of the closest and farthest points in the orbit, $$r_1$$ and $$r_2$$:

$$\mathcal{E}=-{\mu\over r_1+r_2}$$

For an escape or inbound from escape trajectory:

$$\mathcal{E}={v_\infty^2\over 2}$$

where $$v_\infty$$ is the velocity at infinity relative to the body.

For this problem we define:

$$\mu_E$$ = GM of the Earth.
$$\mu_M$$ = GM of the Moon.
$$r_E$$ = low Earth orbit radius.
$$r_M$$ = low Mars orbit radius.
$$a_M$$ = semi-major axis (mean radius) of Moon orbit around Earth.

For simplicity, we will assume that the Moon's orbit is circular, which is not far from the truth.

Using the above, in low-Earth orbit we have for the orbital velocity $$v_{LEO}$$:

$$-{\mu_E\over 2r_E}=\frac{v_E^2}{2}-\frac{\mu_E}{r_E}$$

which gives:

$$v_{LEO}=\sqrt{\mu_E\over r_E}$$

The Hohmann transfer from the Earth to the Moon is half of an elliptical orbit about the Earth with periapsis $$r_E$$ and apoapsis $$a_M$$. For the velocity $$v$$ at any radius $$r$$ in that orbit, we have:

$$-{\mu_E\over r_E+a_M}=\frac{v^2}{2}-\frac{\mu_E}{r}$$

The velocity in that transfer orbit at the radius of a low-Earth orbit, i.e. its periapsis, is:

$$v_p=\sqrt{2a_M \mu_E\over r_E\left(a_M+r_E\right)}$$

The velocity to leave low-Earth orbit to get on the transfer orbit is then:

$$\Delta V_{inject}=v_p-v_{LEO}$$

That's all you need to fly by the Moon, which is the question title. Though you ask in the question body how to get into low-Lunar orbit. You need another maneuver and more propellant to slow down and insert into an orbit.

Applying what was done for LEO, the low-lunar orbit velocity $$v_{LLO}$$ is:

$$v_{LLO}=\sqrt{\mu_M\over r_M}$$

Similarly the velocity of the Moon in its orbit around the Earth is:

$$v_M=\sqrt{\mu_E\over a_M}$$

The velocity in the transfer orbit at the radius of the Moon, i.e. its apoapsis, is:

$$v_a=\sqrt{2r_E \mu_E\over a_M\left(a_M+r_E\right)}$$

The velocity relative to the Moon on approach, if the Moon weren't there, is:

$$v_\infty=v_M-v_a$$

That gives for the velocity on approach when the Moon is there, for any radius from the Moon:

$${v_\infty^2\over 2}=\frac{v^2}{2}-\frac{\mu_M}{r}$$

At the radius of a low-lunar orbit, that velocity is:

$$v_L=\sqrt{\left(v_M-v_a\right)^2+{2\mu_M\over r_M}}$$

To insert into orbit, we need to slow down relative to the Moon by:

$$\Delta V_{insert}=v_L-v_{LLO}$$

The total $$\Delta V$$ is then:

$$\Delta V_{total}=v_p-v_{LEO}+v_L-v_{LLO}$$

Plugging in the numbers, and assuming 200 km LEO and 100 km LLO altitudes, we get:

$$\Delta V_{inject}=3.13\,\mathrm{km\over s}$$
$$\Delta V_{insert}=0.82\,\mathrm{km\over s}$$
$$\Delta V_{total}=3.95\,\mathrm{km\over s}$$

This is close to the answer you get when doing a full integration, allowing the lunar gravity to start pulling on the spacecraft well before it gets to the distance of the Moon. That increases the speed of the spacecraft relative to the Moon a little, increasing the $$\Delta V$$ to insert a little.

This is a direct transfer that can complete in days. If you're willing to take a few months, there are lower $$\Delta V$$ paths that go through generalized Lagrange points. You can save on the order of $$0.1\,\mathrm{km\over s}$$.

Since this is community wiki, we will include things from the relevant link for a lunar flyby and return. The mission trajectory goes as follows:

As for the Delta v value:

Prior to TLI the spacecraft is in a low circular parking orbit around Earth. In this example, we have assumed a parking orbit altitude of 185 kilometers and a TLI delta-v of 3,150 m/s.

Note, also that this has a certain Lunar altitude associated with it.

Pericynthion is the point in the spacecraft's trajectory that is nearest the Moon. For a free return trajectory, the altitude at pericynthion is typically about 100 to 1,500 nautical miles (185 to 2,800 km) - see diagram. The pericynthion altitude in this example is 1,446 kilometers.

If you wanted to graze the surface of the moon, then you would need to adjust the parameters. Fortunately, there are enough to do that. Variables you can control include:

1. the velocity you gain by the burn in LEO
2. the timing at which you do this.

This is assuming everything is in a 2D plane, as in the above image. Things you need to control in order to do the mission (and avoid death) include:

1. the minimum altitude above the moon
2. the impact location on Earth

I list these because the number of variables you can control are equal to the number of variables you need to control. This proves that any given flyby distance is attainable, but it also proves you need to adjust the burn time to achieve that. So in order to approach the moon more closely, you would need to change your propellant requirement. Whether that would make it more or less, I do not know.