There are 4 different rules in 2 books
XGtE contain two options, Tokens and Templates, while DMG has a rule that would make a lot of sense, but it is limited to circular effects.
Yes, using the Template Method from XGtE
Create a template for Lightning Bolt, 1 inch wide, 20 long. Then apply it to the grid as per XGtE (p.86):
you can lay it on the surface; otherwise, hold the template above the surface and take note of which squares it covers or partially covers. If any part of a square is under the template, that square is included in the area of effect.
It is very easy to place such a template to partially cover two adjacent squares.
No, using the Token Method form XGtE
This method only allows for 8 directions, and none of these makes it possible to hit two creatures who are in front of the caster.
Yes, using the half-squares method from the DMG
Choose an intersection of squares or hexes as the point of origin of an area of effect, then follow its rules as normal. If an area of effect is circular and covers at least half a square, it affects that square.
Unfortunately the DMG has nothing about lines, but I see no reason why this could not be applied to any shape.
If you target the center of the edge between the two squares you want to hit, both squares are covered exactly half, so both are effected.
It does not matter if you start the line from the center or the corner (C: Caster, E: Enemy).
Hitting two adjacent creatures with Lightning Bolt might go against designer intent, however it is necessary to keep it competitive with the much more flexible Fireball. Except in very narrow hallways, Fireball wins in number of affected creatures 95% of the time.