What can I do if I wrote a grant proposal with a professor, and now that it is funded he refuses to hire me?
There are at least three possible explanations as why the professor told you he was not going to hire you for the up-coming project,


He wants to do it by himself.
He wants to hire somebody else who has similar qualifications and research capabilities to do it with less salary.
He wants to hire you with the salary less than listed on the proposal budget section to do it.


The first possibility is unlikely because he has no idea what you are doing.

The second one and the third one are equally likely. Both are for the reason that he wants a bigger share of the pie. I cannot tell which one is more likely because you did not get his explanation.

If he did not have a candidate to replace you yet, I guess the reason he said he was not going to hire you was an attempt to negotiate the salary. In other words, he wants you to take a pay cut.

I would suggest you to approach him by a face-to-face meeting if you really want to work with him on this project. During the meeting, politely ask him to explain to you why he was not going to hire you for the project. If he ever expresses the desire to cut your salary, then it's up to you whether to accept the offer.

There could be a fourth possibility that he did not want to hire you because the relationship between you is bad. I exclude this one for now because there is no strong indication in your question that this is the case (otherwise he would not ask you to write the proposal in the first place). If indeed the relationship is bad, you'll need to figure out how to repair it if you want to work with him.