Oscar Ortega-Hernandez, 21, made his first appearance in federal court Thursday, one day after his arrest in Pennsylvania.
Investigators say two bullets he fired from an assault rifle hit the White house Friday night.
Prosecutors say Ortega called President Barack Obama "the devil" and said he needed to be killed.
The president was on a trip to California at the time of the shooting.
Authorities say Ortega has a long criminal record and could be mentally ill.
According to a court document released after the hearing, authorities recovered nine spent shell casings from Ortega's car, which was abandoned near the White House. A person who knows him subsequently told investigators that he had become increasingly agitated with the federal government and was convinced it was conspiring against him, the document said.
The Associated Press contributed to this report.