I pressed Ctrl+Alt+F3 by a mistake and then my computer showed a fullscreen terminal asking for my password and username, How do I get out of that?
Linux systems come with a bunch of virtual terminals, or VTs. Your graphical user interface on Ubuntu runs on VT7, and VT1 to VT6 allow you to login via command line.
You switched to VT3. Press Ctrl+Alt+F7 to get back.
From 17.10 onwards VT1 is used for the display manager ("login screen"), the standard X session uses VT2. Hence we have VT3 as the first usable VT.
Also see Why is my GDM at a different TTY than my desktop environment? for more about the origin of this change.