President Obama and his advisers have approached Senator Judd Gregg, Republican of New Hampshire, about becoming commerce secretary.