When I do it because I didn't know the wheel had already been invented, it's funny (in the sense that others may laugh at the time I wasted. Sometimes I can laugh about it too; other times it takes me a while

). But there are other reasons to invent a new wheel. For instance, in writing a tool (even if it's been done before) I usually learn something I didn't know before. That's useful for the next time ... and there is
always a next time. And then, too, one may feel that a wheel is all very well, but that wheel is green and I want a
blue one, with a slightly elliptical shape and the axle 2cm off-center and a different tread pattern.
But the biggest reason, for me anyway, is that it's
fun. If it isn't fun for you, well, a) I'm sorry, and b) there's not much more to be said—because the above reasons are true, but they probably wouldn't be sufficient (except in cases of special need) if I didn't enjoy coding in the first place. For someone who doesn't like it, the fact that a version already exists out there pretty much ends the debate.