Record / playback keystrokes
Let me start by saying that there are lots of good third party apps for automatically logging in to web forms. I highly recommend using one of those.

To answer your question: Yes, you can do this with a combination of Automator and AppleScript. Here's how.

Open Automator. Go to File-> New. Select Service.
Type applescript into the search bar near the top left.
Drag the Run AppleScript item to the area on the right.
Replace the purple code that starts in the box with this:

tell application "System Events"
    keystroke "username"
    keystroke tab
    keystroke "password"
end tell


Now replace the username text with your username, and replace the password text with your password.
This will have the computer type your username, hit tab, and type your password.
Now, at the top of the Automator window, set Service receives to no input and in to the app you need this to happen in.
Automator shoud now look like this:


Save this and give it a name. Now, go to the app you selected at the top right and put your cursor in the username field.

Go to the app's menu (next to the Apple menu) and choose Services-> {what you named your Automator app}.

It should run the Automator workflow and 'play back' the keystrokes.

Again, this is the hard, insecure way. I highly recommend apps like 1Password and LastPass.