A man from Bangladesh came to the United States intent on perpetrating a terrorist attack, law enforcement officials say, but along the way he met and connected with an FBI informer. As he planned his attack, the FBI was watching, and thwarting him when it mattered.