I only got it because I had done this question a month or so ago and really broke my head over it
The radius of the circle will be either x,y,1-x or 1-y
=>D= 2min{x,y,1-x or 1-y}
So P((D<= d) = 1 - P(D > d) which comes out to be 1-(1-d)^2 ie 2d- d^2
Try drawing the circle in the square as specified in the question, then you'll get it.
For PDF I differentiated cdf wrt d