- I believe that pigs can fly
I think here "that" is being used as a conjunction to combine the independent clause (pigs can fly) with the dependent clause (I believe)
- That the boys painted the pig green annoyed the pig.
This one I'm not so sure about. "The boys painted the pig green" is an independent clause, and "annoyed the pig" is a dependent clause; but in this case "that" doesn't join them.