You probably either pressed a number key (or looked to the upper left) and then <enter>, which activated the chat.
Like metatheurgist said, <esc> gets you out of the input prompt, pressing the number key (can't remember if that's mapped per default to 1 or 2) of this panel closes the panel again.
Don't use <enter> if you want to select some menu item on one of the in-game panels, the default key for that is <space>.
In general, there are four panels in the cockpit that you can open or close through the assigned key or by looking at them. Per default, those keys are 1...4 if you play through keyboard
- left: external panel, can show nav and scan info
- top left: communications
- right: internal panel, ship info. Also the place where you can switch ship options that can't be reached through shortcuts
- bottom: crew, srv, fighter. "We'll get that later", as they say
Additionally, you got an info panel top right where the ship shows you stuff like warnings, that one is completely under the ship's control, you can't influence it.