You may think that's weird, but what's even stranger is that only two of the heads fit into a female during sexual intercourse! During a normal erection, two of the heads get shut down, which allows the other two to fit. The side with the active heads alternates each time the anteater copulates. If all four heads get excited, the four-headed phallus swells up and won't fit where it's supposed to.
This is actually evolutionarily advantageous. A female can mate with as many as 11 males in a row. Hundreds of anteater sperm can team up to form a bundle that can travel faster than individual sperm can, so having extra penis heads to spray more sperm helps give the sperm a fighting chance to fertilize an egg in a competitive environment.
The oddities of the spiny anteater anatomy are explained more in depth in
this article. Also there's a video!