In Robert Garland's course "Greece & Rome: An Integrated History of the Ancient Mediterranean", he mentions that there were doubts Caesarion was really his son with Cleopatra as he was quote, "likely already infertile at this point." Why would historians assume Caesar was potentially infertile? He would have been in his late 40's or early 50's during the time he spent with Cleopatra, certainly not outside the range of being able to father a child. Were there other sources that point to Caesar not able to father children later in life?
Consensus is that Caesarion is likely Caesar's son, both for lack of evidence to the contrary and a logical look at the situation.
Caesar was married three times and had numerous affairs and he only acknowledged one biological child. This can be taken two ways: he either didn't impregnate any other woman which could suggest infertility, or didn't acknowledge any other child.
The possibility persists that Caesar may have believed Marcus Brutus was his son, but still chose not acknowledge him.
He didn't officially recognize Caesarion either, but that wouldn't have necessarily meant he didn't believe the boy was his. Caesar flirted with danger in Egypt and in his relationship with Cleopatra but at the end of the day he was a master politician and PR man. To declare his bastard son with a foreign queen his Roman heir would have been an affront. The issue of extramarital children would be well used against Antony to destroy his reputation later on, a mistake Caesar wasn't going to make. Caesar also knew he had to walk a fine line when it came to how much power he appeared to desire. There were already concerns that Caesar wanted to ruin the Republic and make himself a king. To give himself a 'royal heir' and disgrace his good Roman wife would have looked very shady. I'm less familiar with the particulars of Roman law so I can't quote what the law would be, but I've read a mention before that there was also a legal issue against acknowledging him officially.
As for Cleopatra, despite her unfairly villainous reputation, there was no evidence she had ever been with a man before Caesar. When her father was alive she was busy acting as his surrogate queen, when her brother was alive she was queen and then fleeing for her life. When Caesar and Cleopatra joined forces in a civil war against her brother they alternated between each other's company and managing their forces and Egypt. The idea that she would have the time or desire to canoodle behind Caesar's back is illogical. Caesar was her lifeline, she wouldn't have had real reason to believe Caesar was infertile and no reason to ever risk 'cheating' on him. Her best bet was to sleep with Caesar as often as possible and ensure she was pregnant by him. That child would be excellent leverage.
The TV show Rome shows Cleopatra somewhat desperately sleeping with a random guard to have a child she could pass off as Caesar's. The number of reasons this is ridiculous are numerous and unless you're particularly interested I won't list them all. But suffice to say Cleopatra was a clever ruler and not about to mess up the divine bloodline with some random dude and risk Caesar's ire because she didn't get pregnant the instant she first slept with him.
Most of the rumors against Caesarion's paternity come from people who wanted to villify Cleopatra. Octavian encouraged the defamation but also notably made sure Caesarion was dead despite allowing the children of Antony and Cleopatra to live. That being said, the sons of Antony and Cleopatra somewhat mysteriously disappeared from record later on. But at least at first Octavian had taken them in, and their sister became a queen with Octavian's blessing.
There is a possibility that Caesarion wasn't Caesar's son, but taking all evidence into account, it's likelier that he was.