First, WPA2 does not, cannot, require a username.
You very likely have two layers involved:
Wifi, which may be open, and may be WPA/WPA2 with a passphrase.
Captive portal - AFTER you've connected to wifi, if you browse to anywhere, and everything works, you should be redirected to a captive portal web page, which is likely what is asking for the username and password.
Try it graphically first with Safari, if only to validate the redirect and record the actual target location.
Then, if you want to try a terminal app, Lynx is a famous text browser - there's Lynxlet for Mac, which might or might not work for you.