Absolutely. It is called Sex Reassignment Surgery. Here is a link that entails what needs to be done before you can have the surgery. One of the things to note is that the person in question must live as the desired gender for about a year before a surgery can take place.
There are surgeries that change how your body looks, but you can't really ever change your gender. Gender resides in your brain and is determined before you are born by the presence of sex hormones in your brain as it is developing.
Such surgeries are painful and controversial as they involve a mutilation of healthily functioning organs.